--- linux-2.6.16-rc1/fs/ext2/ext2.h 2006-01-26 22:35:10 +0100 +++ linux-2.6.16-rc1-vs2.1.0.9.4/fs/ext2/ext2.h 2006-01-21 18:28:11 +0100 @@ -162,6 +162,7 @@ extern struct file_operations ext2_xip_f extern struct address_space_operations ext2_aops; extern struct address_space_operations ext2_aops_xip; extern struct address_space_operations ext2_nobh_aops; +extern int ext2_sync_flags(struct inode *inode); /* namei.c */ extern struct inode_operations ext2_dir_inode_operations; --- linux-2.6.16-rc1/fs/ext2/file.c 2005-08-29 22:25:30 +0200 +++ linux-2.6.16-rc1-vs2.1.0.9.4/fs/ext2/file.c 2006-01-21 18:28:17 +0100 @@ -79,4 +80,5 @@ struct inode_operations ext2_file_inode_ #endif .setattr = ext2_setattr, .permission = ext2_permission, + .sync_flags = ext2_sync_flags, }; --- linux-2.6.16-rc1/fs/ext2/inode.c 2006-01-03 17:29:56 +0100 +++ linux-2.6.16-rc1-vs2.1.0.9.4/fs/ext2/inode.c 2006-01-25 05:34:51 +0100 @@ -1065,6 +1080,42 @@ ***** inode->i_flags |= S_DIRSYNC; } +int ext2_sync_flags(struct inode *inode) +{ + unsigned int oldflags, newflags; + + oldflags = EXT2_I(inode)->i_flags; + newflags = oldflags & ~(EXT2_APPEND_FL | + EXT2_IMMUTABLE_FL | EXT2_IUNLINK_FL | + EXT2_BARRIER_FL | EXT2_NOATIME_FL | + EXT2_SYNC_FL | EXT2_DIRSYNC_FL); + + if (IS_APPEND(inode)) + newflags |= EXT2_APPEND_FL; + if (IS_IMMUTABLE(inode)) + newflags |= EXT2_IMMUTABLE_FL; + if (IS_IUNLINK(inode)) + newflags |= EXT2_IUNLINK_FL; + if (IS_BARRIER(inode)) + newflags |= EXT2_BARRIER_FL; + + /* we do not want to copy superblock flags */ + if (inode->i_flags & S_NOATIME) + newflags |= EXT2_NOATIME_FL; + if (inode->i_flags & S_SYNC) + newflags |= EXT2_SYNC_FL; + if (inode->i_flags & S_DIRSYNC) + newflags |= EXT2_DIRSYNC_FL; + + if (oldflags ^ newflags) { + EXT2_I(inode)->i_flags = newflags; + inode->i_ctime = CURRENT_TIME; + mark_inode_dirty(inode); + } + + return 0; +} + void ext2_read_inode (struct inode * inode) { struct ext2_inode_info *ei = EXT2_I(inode); --- linux-2.6.16-rc1/fs/ext2/namei.c 2006-01-26 22:35:11 +0100 +++ linux-2.6.16-rc1-vs2.1.0.9.4/fs/ext2/namei.c 2006-01-25 05:34:51 +0100 @@ -407,6 +409,7 @@ struct inode_operations ext2_dir_inode_o #endif .setattr = ext2_setattr, .permission = ext2_permission, + .sync_flags = ext2_sync_flags, }; struct inode_operations ext2_special_inode_operations = { --- linux-2.6.16-rc1/fs/ext2/namei.c 2006-01-26 22:35:11 +0100 +++ linux-2.6.16-rc1-vs2.1.0.9.4/fs/ext2/namei.c 2006-01-25 05:34:51 +0100 @@ -418,4 +421,5 @@ struct inode_operations ext2_special_ino #endif .setattr = ext2_setattr, .permission = ext2_permission, + .sync_flags = ext2_sync_flags, }; --- linux-2.6.16-rc1/fs/ext2/symlink.c 2005-08-29 22:25:30 +0200 +++ linux-2.6.16-rc1-vs2.1.0.9.4/fs/ext2/symlink.c 2006-01-21 18:28:11 +0100 @@ -38,6 +38,7 @@ struct inode_operations ext2_symlink_ino .listxattr = ext2_listxattr, .removexattr = generic_removexattr, #endif + .sync_flags = ext2_sync_flags, }; struct inode_operations ext2_fast_symlink_inode_operations = { --- linux-2.6.16-rc1/fs/ext2/symlink.c 2005-08-29 22:25:30 +0200 +++ linux-2.6.16-rc1-vs2.1.0.9.4/fs/ext2/symlink.c 2006-01-21 18:28:11 +0100 @@ -49,4 +50,5 @@ struct inode_operations ext2_fast_symlin .listxattr = ext2_listxattr, .removexattr = generic_removexattr, #endif + .sync_flags = ext2_sync_flags, }; --- linux-2.6.16-rc1/fs/ext3/file.c 2005-08-29 22:25:30 +0200 +++ linux-2.6.16-rc1-vs2.1.0.9.4/fs/ext3/file.c 2006-01-21 18:28:17 +0100 @@ -131,5 +132,6 @@ struct inode_operations ext3_file_inode_ .removexattr = generic_removexattr, #endif .permission = ext3_permission, + .sync_flags = ext3_sync_flags, }; --- linux-2.6.16-rc1/fs/ext3/inode.c 2006-01-03 17:29:56 +0100 +++ linux-2.6.16-rc1-vs2.1.0.9.4/fs/ext3/inode.c 2006-01-25 05:34:51 +0100 @@ -2434,6 +2449,57 @@ ***** inode->i_flags |= S_DIRSYNC; } +int ext3_sync_flags(struct inode *inode) +{ + unsigned int oldflags, newflags; + int err = 0; + + oldflags = EXT3_I(inode)->i_flags; + newflags = oldflags & ~(EXT3_APPEND_FL | + EXT3_IMMUTABLE_FL | EXT3_IUNLINK_FL | + EXT3_BARRIER_FL | EXT3_NOATIME_FL | + EXT3_SYNC_FL | EXT3_DIRSYNC_FL); + + if (IS_APPEND(inode)) + newflags |= EXT3_APPEND_FL; + if (IS_IMMUTABLE(inode)) + newflags |= EXT3_IMMUTABLE_FL; + if (IS_IUNLINK(inode)) + newflags |= EXT3_IUNLINK_FL; + if (IS_BARRIER(inode)) + newflags |= EXT3_BARRIER_FL; + + /* we do not want to copy superblock flags */ + if (inode->i_flags & S_NOATIME) + newflags |= EXT3_NOATIME_FL; + if (inode->i_flags & S_SYNC) + newflags |= EXT3_SYNC_FL; + if (inode->i_flags & S_DIRSYNC) + newflags |= EXT3_DIRSYNC_FL; + + if (oldflags ^ newflags) { + handle_t *handle; + struct ext3_iloc iloc; + + handle = ext3_journal_start(inode, 1); + if (IS_ERR(handle)) + return PTR_ERR(handle); + if (IS_SYNC(inode)) + handle->h_sync = 1; + err = ext3_reserve_inode_write(handle, inode, &iloc); + if (err) + goto flags_err; + + EXT3_I(inode)->i_flags = newflags; + inode->i_ctime = CURRENT_TIME; + + err = ext3_mark_iloc_dirty(handle, inode, &iloc); + flags_err: + ext3_journal_stop(handle); + } + return err; +} + void ext3_read_inode(struct inode * inode) { struct ext3_iloc iloc; --- linux-2.6.16-rc1/fs/ext3/namei.c 2006-01-26 22:35:11 +0100 +++ linux-2.6.16-rc1-vs2.1.0.9.4/fs/ext3/namei.c 2006-01-25 05:34:51 +0100 @@ -2372,6 +2374,7 @@ struct inode_operations ext3_dir_inode_o .removexattr = generic_removexattr, #endif .permission = ext3_permission, + .sync_flags = ext3_sync_flags, }; struct inode_operations ext3_special_inode_operations = { --- linux-2.6.16-rc1/fs/ext3/namei.c 2006-01-26 22:35:11 +0100 +++ linux-2.6.16-rc1-vs2.1.0.9.4/fs/ext3/namei.c 2006-01-25 05:34:51 +0100 @@ -2383,4 +2386,5 @@ struct inode_operations ext3_special_ino .removexattr = generic_removexattr, #endif .permission = ext3_permission, + .sync_flags = ext3_sync_flags, }; --- linux-2.6.16-rc1/fs/ext3/symlink.c 2005-08-29 22:25:30 +0200 +++ linux-2.6.16-rc1-vs2.1.0.9.4/fs/ext3/symlink.c 2006-01-21 18:28:11 +0100 @@ -40,6 +40,7 @@ struct inode_operations ext3_symlink_ino .listxattr = ext3_listxattr, .removexattr = generic_removexattr, #endif + .sync_flags = ext3_sync_flags, }; struct inode_operations ext3_fast_symlink_inode_operations = { --- linux-2.6.16-rc1/fs/ext3/symlink.c 2005-08-29 22:25:30 +0200 +++ linux-2.6.16-rc1-vs2.1.0.9.4/fs/ext3/symlink.c 2006-01-21 18:28:11 +0100 @@ -51,4 +52,5 @@ struct inode_operations ext3_fast_symlin .listxattr = ext3_listxattr, .removexattr = generic_removexattr, #endif + .sync_flags = ext3_sync_flags, }; --- linux-2.6.16-rc1/fs/quota_v2.c 2006-01-26 22:35:12 +0100 +++ linux-2.6.16-rc1-vs2.1.0.9.4/fs/quota_v2.c 2006-01-21 18:28:18 +0100 @@ -84,7 +85,7 @@ static int v2_write_file_info(struct sup dinfo.dqi_blocks = cpu_to_le32(info->u.v2_i.dqi_blocks); dinfo.dqi_free_blk = cpu_to_le32(info->u.v2_i.dqi_free_blk); dinfo.dqi_free_entry = cpu_to_le32(info->u.v2_i.dqi_free_entry); - size = sb->s_op->quota_write(sb, type, (char *)&dinfo, + size = hash->dqh_sb->s_op->quota_write(hash, type, (char *)&dinfo, sizeof(struct v2_disk_dqinfo), V2_DQINFOOFF); if (size != sizeof(struct v2_disk_dqinfo)) { printk(KERN_WARNING "Can't write info structure on device %s.\n", --- linux-2.6.16-rc1/fs/reiserfs/file.c 2006-01-26 22:35:13 +0100 +++ linux-2.6.16-rc1-vs2.1.0.9.4/fs/reiserfs/file.c 2006-01-21 18:28:11 +0100 @@ -1555,6 +1555,7 @@ struct file_operations reiserfs_file_ope .release = reiserfs_file_release, .fsync = reiserfs_sync_file, .sendfile = generic_file_sendfile, + .sendpage = generic_file_sendpage, .aio_read = generic_file_aio_read, .aio_write = reiserfs_aio_write, }; --- linux-2.6.16-rc1/fs/reiserfs/file.c 2006-01-26 22:35:13 +0100 +++ linux-2.6.16-rc1-vs2.1.0.9.4/fs/reiserfs/file.c 2006-01-21 18:28:11 +0100 @@ -1567,4 +1568,5 @@ struct inode_operations reiserfs_file_in .listxattr = reiserfs_listxattr, .removexattr = reiserfs_removexattr, .permission = reiserfs_permission, + .sync_flags = reiserfs_sync_flags, }; --- linux-2.6.16-rc1/fs/reiserfs/inode.c 2006-01-26 22:35:13 +0100 +++ linux-2.6.16-rc1-vs2.1.0.9.4/fs/reiserfs/inode.c 2006-01-25 05:34:51 +0100 @@ -2895,6 +2931,22 @@ static ssize_t reiserfs_direct_IO(int rw reiserfs_get_blocks_direct_io, NULL); } +int reiserfs_sync_flags(struct inode *inode) +{ + u16 oldflags, newflags; + + oldflags = REISERFS_I(inode)->i_attrs; + newflags = oldflags; + i_attrs_to_sd_attrs(inode, &newflags); + + if (oldflags ^ newflags) { + REISERFS_I(inode)->i_attrs = newflags; + inode->i_ctime = CURRENT_TIME_SEC; + mark_inode_dirty(inode); + } + return 0; +} + int reiserfs_setattr(struct dentry *dentry, struct iattr *attr) { struct inode *inode = dentry->d_inode; --- linux-2.6.16-rc1/fs/reiserfs/namei.c 2006-01-26 22:35:13 +0100 +++ linux-2.6.16-rc1-vs2.1.0.9.4/fs/reiserfs/namei.c 2006-01-25 05:34:51 +0100 @@ -1546,6 +1549,7 @@ struct inode_operations reiserfs_dir_ino .listxattr = reiserfs_listxattr, .removexattr = reiserfs_removexattr, .permission = reiserfs_permission, + .sync_flags = reiserfs_sync_flags, }; /* --- linux-2.6.16-rc1/fs/reiserfs/namei.c 2006-01-26 22:35:13 +0100 +++ linux-2.6.16-rc1-vs2.1.0.9.4/fs/reiserfs/namei.c 2006-01-25 05:34:51 +0100 @@ -1562,6 +1566,7 @@ struct inode_operations reiserfs_symlink .listxattr = reiserfs_listxattr, .removexattr = reiserfs_removexattr, .permission = reiserfs_permission, + .sync_flags = reiserfs_sync_flags, }; --- linux-2.6.16-rc1/fs/reiserfs/namei.c 2006-01-26 22:35:13 +0100 +++ linux-2.6.16-rc1-vs2.1.0.9.4/fs/reiserfs/namei.c 2006-01-25 05:34:51 +0100 @@ -1575,5 +1580,6 @@ struct inode_operations reiserfs_special .listxattr = reiserfs_listxattr, .removexattr = reiserfs_removexattr, .permission = reiserfs_permission, + .sync_flags = reiserfs_sync_flags, }; --- linux-2.6.16-rc1/fs/xfs/linux-2.6/xfs_iops.c 2006-01-26 22:35:13 +0100 +++ linux-2.6.16-rc1-vs2.1.0.9.4/fs/xfs/linux-2.6/xfs_iops.c 2006-01-25 05:34:51 +0100 @@ -632,6 +634,41 @@ linvfs_getattr( } STATIC int +linvfs_sync_flags(struct inode *inode) +{ + unsigned int oldflags, newflags; + vattr_t vattr; + int flags = 0; + int error; + vnode_t *vp = LINVFS_GET_VP(inode); + + memset(&vattr, 0, sizeof(vattr_t)); + + vattr.va_mask = XFS_AT_XFLAGS; + VOP_GETATTR(vp, &vattr, 0, NULL, error); + if (error) + return error; + oldflags = vattr.va_xflags; + newflags = oldflags & ~(XFS_XFLAG_IMMUTABLE | + XFS_XFLAG_IUNLINK | XFS_XFLAG_BARRIER); + + if (IS_IMMUTABLE(inode)) + newflags |= XFS_XFLAG_IMMUTABLE; + if (IS_IUNLINK(inode)) + newflags |= XFS_XFLAG_IUNLINK; + if (IS_BARRIER(inode)) + newflags |= XFS_XFLAG_BARRIER; + + if (oldflags ^ newflags) { + vattr.va_xflags = newflags; + vattr.va_mask |= XFS_AT_XFLAGS; + VOP_SETATTR(vp, &vattr, flags, NULL, error); + } + vn_revalidate(vp); + return error; +} + +STATIC int linvfs_setattr( struct dentry *dentry, struct iattr *attr) --- linux-2.6.16-rc1/fs/xfs/linux-2.6/xfs_iops.c 2006-01-26 22:35:13 +0100 +++ linux-2.6.16-rc1-vs2.1.0.9.4/fs/xfs/linux-2.6/xfs_iops.c 2006-01-25 05:34:51 +0100 @@ -809,6 +854,7 @@ struct inode_operations linvfs_file_inod .getxattr = linvfs_getxattr, .listxattr = linvfs_listxattr, .removexattr = linvfs_removexattr, + .sync_flags = linvfs_sync_flags, }; struct inode_operations linvfs_dir_inode_operations = { --- linux-2.6.16-rc1/fs/xfs/linux-2.6/xfs_iops.c 2006-01-26 22:35:13 +0100 +++ linux-2.6.16-rc1-vs2.1.0.9.4/fs/xfs/linux-2.6/xfs_iops.c 2006-01-25 05:34:51 +0100 @@ -828,6 +874,7 @@ struct inode_operations linvfs_dir_inode .getxattr = linvfs_getxattr, .listxattr = linvfs_listxattr, .removexattr = linvfs_removexattr, + .sync_flags = linvfs_sync_flags, }; struct inode_operations linvfs_symlink_inode_operations = { --- linux-2.6.16-rc1/fs/xfs/linux-2.6/xfs_iops.c 2006-01-26 22:35:13 +0100 +++ linux-2.6.16-rc1-vs2.1.0.9.4/fs/xfs/linux-2.6/xfs_iops.c 2006-01-25 05:34:51 +0100 @@ -841,4 +888,5 @@ struct inode_operations linvfs_symlink_i .getxattr = linvfs_getxattr, .listxattr = linvfs_listxattr, .removexattr = linvfs_removexattr, + .sync_flags = linvfs_sync_flags, }; --- linux-2.6.16-rc1/include/linux/ext3_fs.h 2005-10-28 20:49:54 +0200 +++ linux-2.6.16-rc1-vs2.1.0.9.4/include/linux/ext3_fs.h 2006-01-25 05:34:51 +0100 @@ -775,6 +787,7 @@ extern unsigned long ext3_count_free (st extern int ext3_forget(handle_t *, int, struct inode *, struct buffer_head *, int); extern struct buffer_head * ext3_getblk (handle_t *, struct inode *, long, int, int *); extern struct buffer_head * ext3_bread (handle_t *, struct inode *, int, int, int *); +extern int ext3_sync_flags(struct inode *inode); extern void ext3_read_inode (struct inode *); extern int ext3_write_inode (struct inode *, int); --- linux-2.6.16-rc1/include/linux/fs.h 2006-01-26 22:35:19 +0100 +++ linux-2.6.16-rc1-vs2.1.0.9.4/include/linux/fs.h 2006-01-29 16:01:52 +0100 @@ -1046,6 +1067,7 @@ struct inode_operations { ssize_t (*listxattr) (struct dentry *, char *, size_t); int (*removexattr) (struct dentry *, const char *); void (*truncate_range)(struct inode *, loff_t, loff_t); + int (*sync_flags) (struct inode *); }; struct seq_file; --- linux-2.6.16-rc1/include/linux/reiserfs_fs.h 2006-01-26 22:35:20 +0100 +++ linux-2.6.16-rc1-vs2.1.0.9.4/include/linux/reiserfs_fs.h 2006-01-21 18:28:11 +0100 @@ -1904,6 +1916,7 @@ static inline void reiserfs_update_sd(st void sd_attrs_to_i_attrs(__u16 sd_attrs, struct inode *inode); void i_attrs_to_sd_attrs(struct inode *inode, __u16 * sd_attrs); int reiserfs_setattr(struct dentry *dentry, struct iattr *attr); +int reiserfs_sync_flags(struct inode *inode); /* namei.c */ void set_de_name_and_namelen(struct reiserfs_dir_entry *de); --- linux-2.6.16-rc1/include/linux/vs_tag.h 1970-01-01 01:00:00 +0100 +++ linux-2.6.16-rc1-vs2.1.0.9.4/include/linux/vs_tag.h 2006-01-27 21:59:52 +0100 @@ -0,0 +1,46 @@ +#ifndef _VX_VS_TAG_H +#define _VX_VS_TAG_H + +#include +#include + + +/* check conditions */ + +#define DX_ADMIN 0x0001 +#define DX_WATCH 0x0002 +#define DX_HOSTID 0x0008 + +#define DX_IDENT 0x0010 + +#define DX_ARG_MASK 0x0010 + + +#define dx_task_tag(t) ((t)->xid) + +#define dx_current_tag() dx_task_tag(current) + +#define dx_check(c,m) __dx_check(dx_current_tag(),c,m) + +#define dx_weak_check(c,m) ((m) ? dx_check(c,m) : 1) + + +/* + * check current context for ADMIN/WATCH and + * optionally against supplied argument + */ +static inline int __dx_check(tag_t cid, tag_t id, unsigned int mode) +{ + if (mode & DX_ARG_MASK) { + if ((mode & DX_IDENT) && + (id == cid)) + return 1; + } + return (((mode & DX_ADMIN) && (cid == 0)) || + ((mode & DX_WATCH) && (cid == 1)) || + ((mode & DX_HOSTID) && (id == 0))); +} + +#else +#warning duplicate inclusion +#endif