--- linux-2.6.14/fs/attr.c 2005-08-29 22:25:30 +0200 +++ linux-2.6.14-vs2.0.1-pre3/fs/attr.c 2005-10-29 04:22:54 +0200 @@ -64,6 +89,24 @@ error: EXPORT_SYMBOL(inode_change_ok); +int inode_setattr_flags(struct inode *inode, unsigned int flags) +{ + unsigned int oldflags, newflags; + + oldflags = inode->i_flags; + newflags = oldflags & ~(S_IMMUTABLE | S_IUNLINK | S_BARRIER); + if (flags & ATTR_FLAG_IMMUTABLE) + newflags |= S_IMMUTABLE; + if (flags & ATTR_FLAG_IUNLINK) + newflags |= S_IUNLINK; + if (flags & ATTR_FLAG_BARRIER) + newflags |= S_BARRIER; + + if (oldflags ^ newflags) + inode->i_flags = newflags; + return 0; +} + int inode_setattr(struct inode * inode, struct iattr * attr) { unsigned int ia_valid = attr->ia_valid; --- linux-2.6.14/fs/attr.c 2005-08-29 22:25:30 +0200 +++ linux-2.6.14-vs2.0.1-pre3/fs/attr.c 2005-10-29 04:22:54 +0200 @@ -103,6 +148,8 @@ int inode_setattr(struct inode * inode, mode &= ~S_ISGID; inode->i_mode = mode; } + if (ia_valid & ATTR_ATTR_FLAG) + inode_setattr_flags(inode, attr->ia_attr_flags); mark_inode_dirty(inode); out: return error; --- linux-2.6.14/fs/ext2/ialloc.c 2005-10-28 20:49:44 +0200 +++ linux-2.6.14-vs2.0.1-pre3/fs/ext2/ialloc.c 2005-10-29 16:14:51 +0200 @@ -579,7 +587,8 @@ got: inode->i_blocks = 0; inode->i_mtime = inode->i_atime = inode->i_ctime = CURRENT_TIME_SEC; memset(ei->i_data, 0, sizeof(ei->i_data)); - ei->i_flags = EXT2_I(dir)->i_flags & ~EXT2_BTREE_FL; + ei->i_flags = EXT2_I(dir)->i_flags & + ~(EXT2_BTREE_FL|EXT2_IUNLINK_FL|EXT2_BARRIER_FL); if (S_ISLNK(mode)) ei->i_flags &= ~(EXT2_IMMUTABLE_FL|EXT2_APPEND_FL); /* dirsync is only applied to directories */ --- linux-2.6.14/fs/ext2/inode.c 2005-10-28 20:49:44 +0200 +++ linux-2.6.14-vs2.0.1-pre3/fs/ext2/inode.c 2005-10-29 04:22:54 +0200 @@ -66,6 +67,8 @@ void ext2_put_inode(struct inode *inode) ext2_discard_prealloc(inode); } +static void ext2_truncate_nocheck (struct inode * inode); + /* * Called at the last iput() if i_nlink is zero. */ --- linux-2.6.14/fs/ext2/inode.c 2005-10-28 20:49:44 +0200 +++ linux-2.6.14-vs2.0.1-pre3/fs/ext2/inode.c 2005-10-29 04:22:54 +0200 @@ -81,7 +84,7 @@ void ext2_delete_inode (struct inode * i inode->i_size = 0; if (inode->i_blocks) - ext2_truncate (inode); + ext2_truncate_nocheck(inode); ext2_free_inode (inode); return; --- linux-2.6.14/fs/ext2/inode.c 2005-10-28 20:49:44 +0200 +++ linux-2.6.14-vs2.0.1-pre3/fs/ext2/inode.c 2005-10-29 04:22:54 +0200 @@ -902,7 +905,7 @@ static void ext2_free_branches(struct in ext2_free_data(inode, p, q); } -void ext2_truncate (struct inode * inode) +static void ext2_truncate_nocheck(struct inode * inode) { __le32 *i_data = EXT2_I(inode)->i_data; int addr_per_block = EXT2_ADDR_PER_BLOCK(inode->i_sb); --- linux-2.6.14/fs/ext2/inode.c 2005-10-28 20:49:44 +0200 +++ linux-2.6.14-vs2.0.1-pre3/fs/ext2/inode.c 2005-10-29 04:22:54 +0200 @@ -919,8 +922,6 @@ void ext2_truncate (struct inode * inode return; if (ext2_inode_is_fast_symlink(inode)) return; - if (IS_APPEND(inode) || IS_IMMUTABLE(inode)) - return; ext2_discard_prealloc(inode); --- linux-2.6.14/fs/ext2/inode.c 2005-10-28 20:49:44 +0200 +++ linux-2.6.14-vs2.0.1-pre3/fs/ext2/inode.c 2005-10-29 04:22:54 +0200 @@ -1044,17 +1045,28 @@ Egdp: return ERR_PTR(-EIO); } +void ext2_truncate (struct inode * inode) +{ + if (IS_APPEND(inode) || IS_IMMUTABLE(inode)) + return; + ext2_truncate_nocheck(inode); +} + void ext2_set_inode_flags(struct inode *inode) { unsigned int flags = EXT2_I(inode)->i_flags; - inode->i_flags &= ~(S_SYNC|S_APPEND|S_IMMUTABLE|S_NOATIME|S_DIRSYNC); + inode->i_flags &= ~(S_SYNC|S_APPEND|S_IMMUTABLE|S_IUNLINK|S_BARRIER|S_NOATIME|S_DIRSYNC); if (flags & EXT2_SYNC_FL) inode->i_flags |= S_SYNC; if (flags & EXT2_APPEND_FL) inode->i_flags |= S_APPEND; if (flags & EXT2_IMMUTABLE_FL) inode->i_flags |= S_IMMUTABLE; + if (flags & EXT2_IUNLINK_FL) + inode->i_flags |= S_IUNLINK; + if (flags & EXT2_BARRIER_FL) + inode->i_flags |= S_BARRIER; if (flags & EXT2_NOATIME_FL) inode->i_flags |= S_NOATIME; if (flags & EXT2_DIRSYNC_FL) --- linux-2.6.14/fs/ext2/inode.c 2005-10-28 20:49:44 +0200 +++ linux-2.6.14-vs2.0.1-pre3/fs/ext2/inode.c 2005-10-29 04:22:54 +0200 @@ -1293,6 +1315,27 @@ int ext2_sync_inode(struct inode *inode) return sync_inode(inode, &wbc); } +int ext2_setattr_flags(struct inode *inode, unsigned int flags) +{ + unsigned int oldflags, newflags; + + oldflags = EXT2_I(inode)->i_flags; + newflags = oldflags & + ~(EXT2_IMMUTABLE_FL | EXT2_IUNLINK_FL | EXT2_BARRIER_FL); + if (flags & ATTR_FLAG_IMMUTABLE) + newflags |= EXT2_IMMUTABLE_FL; + if (flags & ATTR_FLAG_IUNLINK) + newflags |= EXT2_IUNLINK_FL; + if (flags & ATTR_FLAG_BARRIER) + newflags |= EXT2_BARRIER_FL; + + if (oldflags ^ newflags) { + EXT2_I(inode)->i_flags = newflags; + inode->i_ctime = CURRENT_TIME; + } + return 0; +} + int ext2_setattr(struct dentry *dentry, struct iattr *iattr) { struct inode *inode = dentry->d_inode; --- linux-2.6.14/fs/ext2/ioctl.c 2005-03-02 12:38:44 +0100 +++ linux-2.6.14-vs2.0.1-pre3/fs/ext2/ioctl.c 2005-10-30 04:29:36 +0100 @@ -49,7 +49,9 @@ int ext2_ioctl (struct inode * inode, st * * This test looks nicer. Thanks to Pauline Middelink */ - if ((flags ^ oldflags) & (EXT2_APPEND_FL | EXT2_IMMUTABLE_FL)) { + if ((oldflags & EXT2_IMMUTABLE_FL) || + ((flags ^ oldflags) & (EXT2_APPEND_FL | + EXT2_IMMUTABLE_FL | EXT2_IUNLINK_FL))) { if (!capable(CAP_LINUX_IMMUTABLE)) return -EPERM; } --- linux-2.6.14/fs/ext3/ialloc.c 2005-10-28 20:49:44 +0200 +++ linux-2.6.14-vs2.0.1-pre3/fs/ext3/ialloc.c 2005-10-29 20:57:14 +0200 @@ -565,7 +574,8 @@ got: ei->i_dir_start_lookup = 0; ei->i_disksize = 0; - ei->i_flags = EXT3_I(dir)->i_flags & ~EXT3_INDEX_FL; + ei->i_flags = EXT3_I(dir)->i_flags & + ~(EXT3_INDEX_FL|EXT3_IUNLINK_FL|EXT3_BARRIER_FL); if (S_ISLNK(mode)) ei->i_flags &= ~(EXT3_IMMUTABLE_FL|EXT3_APPEND_FL); /* dirsync only applies to directories */ --- linux-2.6.14/fs/ext3/inode.c 2005-10-28 20:49:44 +0200 +++ linux-2.6.14-vs2.0.1-pre3/fs/ext3/inode.c 2005-10-29 04:22:54 +0200 @@ -180,6 +181,8 @@ static int ext3_journal_test_restart(han return ext3_journal_restart(handle, blocks_for_truncate(inode)); } +static void ext3_truncate_nocheck (struct inode *inode); + /* * Called at the last iput() if i_nlink is zero. */ --- linux-2.6.14/fs/ext3/inode.c 2005-10-28 20:49:44 +0200 +++ linux-2.6.14-vs2.0.1-pre3/fs/ext3/inode.c 2005-10-29 04:22:54 +0200 @@ -205,7 +208,7 @@ void ext3_delete_inode (struct inode * i handle->h_sync = 1; inode->i_size = 0; if (inode->i_blocks) - ext3_truncate(inode); + ext3_truncate_nocheck(inode); /* * Kill off the orphan record which ext3_truncate created. * AKPM: I think this can be inside the above `if'. --- linux-2.6.14/fs/ext3/inode.c 2005-10-28 20:49:44 +0200 +++ linux-2.6.14-vs2.0.1-pre3/fs/ext3/inode.c 2005-10-29 04:22:54 +0200 @@ -2067,7 +2070,7 @@ static void ext3_free_branches(handle_t * ext3_truncate() run will find them and release them. */ -void ext3_truncate(struct inode * inode) +void ext3_truncate_nocheck(struct inode * inode) { handle_t *handle; struct ext3_inode_info *ei = EXT3_I(inode); --- linux-2.6.14/fs/ext3/inode.c 2005-10-28 20:49:44 +0200 +++ linux-2.6.14-vs2.0.1-pre3/fs/ext3/inode.c 2005-10-29 04:22:54 +0200 @@ -2088,8 +2091,6 @@ void ext3_truncate(struct inode * inode) return; if (ext3_inode_is_fast_symlink(inode)) return; - if (IS_APPEND(inode) || IS_IMMUTABLE(inode)) - return; /* * We have to lock the EOF page here, because lock_page() nests --- linux-2.6.14/fs/ext3/inode.c 2005-10-28 20:49:44 +0200 +++ linux-2.6.14-vs2.0.1-pre3/fs/ext3/inode.c 2005-10-29 04:22:54 +0200 @@ -2408,17 +2409,28 @@ int ext3_get_inode_loc(struct inode *ino !(EXT3_I(inode)->i_state & EXT3_STATE_XATTR)); } +void ext3_truncate(struct inode * inode) +{ + if (IS_APPEND(inode) || IS_IMMUTABLE(inode)) + return; + ext3_truncate_nocheck(inode); +} + void ext3_set_inode_flags(struct inode *inode) { unsigned int flags = EXT3_I(inode)->i_flags; - inode->i_flags &= ~(S_SYNC|S_APPEND|S_IMMUTABLE|S_NOATIME|S_DIRSYNC); + inode->i_flags &= ~(S_SYNC|S_APPEND|S_IMMUTABLE|S_IUNLINK|S_BARRIER|S_NOATIME|S_DIRSYNC); if (flags & EXT3_SYNC_FL) inode->i_flags |= S_SYNC; if (flags & EXT3_APPEND_FL) inode->i_flags |= S_APPEND; if (flags & EXT3_IMMUTABLE_FL) inode->i_flags |= S_IMMUTABLE; + if (flags & EXT3_IUNLINK_FL) + inode->i_flags |= S_IUNLINK; + if (flags & EXT3_BARRIER_FL) + inode->i_flags |= S_BARRIER; if (flags & EXT3_NOATIME_FL) inode->i_flags |= S_NOATIME; if (flags & EXT3_DIRSYNC_FL) --- linux-2.6.14/fs/ext3/inode.c 2005-10-28 20:49:44 +0200 +++ linux-2.6.14-vs2.0.1-pre3/fs/ext3/inode.c 2005-10-29 04:22:54 +0200 @@ -2732,6 +2756,44 @@ int ext3_write_inode(struct inode *inode return ext3_force_commit(inode->i_sb); } +int ext3_setattr_flags(struct inode *inode, unsigned int flags) +{ + unsigned int oldflags, newflags; + int err = 0; + + oldflags = EXT3_I(inode)->i_flags; + newflags = oldflags & + ~(EXT3_IMMUTABLE_FL | EXT3_IUNLINK_FL | EXT3_BARRIER_FL); + if (flags & ATTR_FLAG_IMMUTABLE) + newflags |= EXT3_IMMUTABLE_FL; + if (flags & ATTR_FLAG_IUNLINK) + newflags |= EXT3_IUNLINK_FL; + if (flags & ATTR_FLAG_BARRIER) + newflags |= EXT3_BARRIER_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; +} + /* * ext3_setattr() * --- linux-2.6.14/fs/ext3/inode.c 2005-10-28 20:49:44 +0200 +++ linux-2.6.14-vs2.0.1-pre3/fs/ext3/inode.c 2005-10-29 04:22:54 +0200 @@ -2804,6 +2869,12 @@ int ext3_setattr(struct dentry *dentry, ext3_journal_stop(handle); } + if (ia_valid & ATTR_ATTR_FLAG) { + rc = ext3_setattr_flags(inode, attr->ia_attr_flags); + if (!error) + error = rc; + } + rc = inode_setattr(inode, attr); /* If inode_setattr's call to ext3_truncate failed to get a --- linux-2.6.14/fs/ext3/ioctl.c 2005-06-22 02:38:36 +0200 +++ linux-2.6.14-vs2.0.1-pre3/fs/ext3/ioctl.c 2005-10-30 04:29:36 +0100 @@ -58,7 +59,9 @@ int ext3_ioctl (struct inode * inode, st * * This test looks nicer. Thanks to Pauline Middelink */ - if ((flags ^ oldflags) & (EXT3_APPEND_FL | EXT3_IMMUTABLE_FL)) { + if ((oldflags & EXT3_IMMUTABLE_FL) || + ((flags ^ oldflags) & (EXT3_APPEND_FL | + EXT3_IMMUTABLE_FL | EXT3_IUNLINK_FL))) { if (!capable(CAP_LINUX_IMMUTABLE)) return -EPERM; } --- linux-2.6.14/fs/namei.c 2005-10-28 20:49:44 +0200 +++ linux-2.6.14-vs2.0.1-pre3/fs/namei.c 2005-10-30 04:29:36 +0100 @@ -1199,7 +1241,7 @@ static inline int may_delete(struct inod if (IS_APPEND(dir)) return -EPERM; if (check_sticky(dir, victim->d_inode)||IS_APPEND(victim->d_inode)|| - IS_IMMUTABLE(victim->d_inode)) + IS_IXORUNLINK(victim->d_inode)) return -EPERM; if (isdir) { if (!S_ISDIR(victim->d_inode->i_mode)) --- linux-2.6.14/fs/namei.c 2005-10-28 20:49:44 +0200 +++ linux-2.6.14-vs2.0.1-pre3/fs/namei.c 2005-10-30 04:29:36 +0100 @@ -1997,7 +2039,7 @@ int vfs_link(struct dentry *old_dentry, /* * A link to an append-only or immutable file cannot be created. */ - if (IS_APPEND(inode) || IS_IMMUTABLE(inode)) + if (IS_APPEND(inode) || IS_IXORUNLINK(inode)) return -EPERM; if (!dir->i_op || !dir->i_op->link) return -EPERM; --- linux-2.6.14/fs/reiserfs/bitmap.c 2005-08-29 22:25:33 +0200 +++ linux-2.6.14-vs2.0.1-pre3/fs/reiserfs/bitmap.c 2005-10-29 18:09:54 +0200 @@ -1045,7 +1050,12 @@ static inline int blocknrs_and_prealloc_ hint->prealloc_size); if (quota_ret) hint->preallocate = hint->prealloc_size = 0; + if (DLIMIT_ALLOC_BLOCK(hint->inode, hint->prealloc_size)) { + DQUOT_FREE_BLOCK_NODIRTY(hint->inode, hint->prealloc_size); + hint->preallocate=hint->prealloc_size=0; + } } + /* for unformatted nodes, force large allocations */ bigalloc = amount_needed; } --- linux-2.6.14/fs/reiserfs/inode.c 2005-10-28 20:49:45 +0200 +++ linux-2.6.14-vs2.0.1-pre3/fs/reiserfs/inode.c 2005-10-29 04:22:54 +0200 @@ -2688,6 +2708,14 @@ void sd_attrs_to_i_attrs(__u16 sd_attrs, inode->i_flags |= S_IMMUTABLE; else inode->i_flags &= ~S_IMMUTABLE; + if (sd_attrs & REISERFS_IUNLINK_FL) + inode->i_flags |= S_IUNLINK; + else + inode->i_flags &= ~S_IUNLINK; + if (sd_attrs & REISERFS_BARRIER_FL) + inode->i_flags |= S_BARRIER; + else + inode->i_flags &= ~S_BARRIER; if (sd_attrs & REISERFS_APPEND_FL) inode->i_flags |= S_APPEND; else --- linux-2.6.14/fs/reiserfs/inode.c 2005-10-28 20:49:45 +0200 +++ linux-2.6.14-vs2.0.1-pre3/fs/reiserfs/inode.c 2005-10-29 04:22:54 +0200 @@ -2710,6 +2738,14 @@ void i_attrs_to_sd_attrs(struct inode *i *sd_attrs |= REISERFS_IMMUTABLE_FL; else *sd_attrs &= ~REISERFS_IMMUTABLE_FL; + if (inode->i_flags & S_IUNLINK) + *sd_attrs |= REISERFS_IUNLINK_FL; + else + *sd_attrs &= ~REISERFS_IUNLINK_FL; + if (inode->i_flags & S_BARRIER) + *sd_attrs |= REISERFS_BARRIER_FL; + else + *sd_attrs &= ~REISERFS_BARRIER_FL; if (inode->i_flags & S_SYNC) *sd_attrs |= REISERFS_SYNC_FL; else --- linux-2.6.14/fs/reiserfs/inode.c 2005-10-28 20:49:45 +0200 +++ linux-2.6.14-vs2.0.1-pre3/fs/reiserfs/inode.c 2005-10-29 04:22:54 +0200 @@ -2885,6 +2921,27 @@ static ssize_t reiserfs_direct_IO(int rw reiserfs_get_blocks_direct_io, NULL); } +int reiserfs_setattr_flags(struct inode *inode, unsigned int flags) +{ + unsigned int oldflags, newflags; + + oldflags = REISERFS_I(inode)->i_flags; + newflags = oldflags & ~(REISERFS_IMMUTABLE_FL | + REISERFS_IUNLINK_FL | REISERFS_BARRIER_FL); + if (flags & ATTR_FLAG_IMMUTABLE) + newflags |= REISERFS_IMMUTABLE_FL; + if (flags & ATTR_FLAG_IUNLINK) + newflags |= REISERFS_IUNLINK_FL; + if (flags & ATTR_FLAG_BARRIER) + newflags |= REISERFS_BARRIER_FL; + + if (oldflags ^ newflags) { + REISERFS_I(inode)->i_flags = newflags; + inode->i_ctime = CURRENT_TIME; + } + return 0; +} + int reiserfs_setattr(struct dentry *dentry, struct iattr *attr) { struct inode *inode = dentry->d_inode; --- linux-2.6.14/fs/reiserfs/inode.c 2005-10-28 20:49:45 +0200 +++ linux-2.6.14-vs2.0.1-pre3/fs/reiserfs/inode.c 2005-10-29 04:22:54 +0200 @@ -2929,9 +2986,14 @@ int reiserfs_setattr(struct dentry *dent } error = inode_change_ok(inode, attr); + + if (!error && attr->ia_valid & ATTR_ATTR_FLAG) + reiserfs_setattr_flags(inode, attr->ia_attr_flags); + if (!error) { if ((ia_valid & ATTR_UID && attr->ia_uid != inode->i_uid) || - (ia_valid & ATTR_GID && attr->ia_gid != inode->i_gid)) { + (ia_valid & ATTR_GID && attr->ia_gid != inode->i_gid) || + (ia_valid & ATTR_XID && attr->ia_xid != inode->i_xid)) { error = reiserfs_chown_xattrs(inode, attr); if (!error) { --- linux-2.6.14/fs/reiserfs/inode.c 2005-10-28 20:49:45 +0200 +++ linux-2.6.14-vs2.0.1-pre3/fs/reiserfs/inode.c 2005-10-29 04:22:54 +0200 @@ -2961,6 +3023,8 @@ int reiserfs_setattr(struct dentry *dent inode->i_uid = attr->ia_uid; if (attr->ia_valid & ATTR_GID) inode->i_gid = attr->ia_gid; + if ((attr->ia_valid & ATTR_XID) && IS_TAGXID(inode)) + inode->i_xid = attr->ia_xid; mark_inode_dirty(inode); error = journal_end(&th, inode->i_sb, jbegin_count); --- linux-2.6.14/fs/reiserfs/ioctl.c 2005-08-29 22:25:33 +0200 +++ linux-2.6.14-vs2.0.1-pre3/fs/reiserfs/ioctl.c 2005-10-30 04:29:36 +0100 @@ -22,7 +22,7 @@ static int reiserfs_unpack(struct inode int reiserfs_ioctl(struct inode *inode, struct file *filp, unsigned int cmd, unsigned long arg) { - unsigned int flags; + unsigned int flags, oldflags; switch (cmd) { case REISERFS_IOC_UNPACK: --- linux-2.6.14/fs/reiserfs/ioctl.c 2005-08-29 22:25:33 +0200 +++ linux-2.6.14-vs2.0.1-pre3/fs/reiserfs/ioctl.c 2005-10-30 04:29:36 +0100 @@ -41,6 +41,7 @@ int reiserfs_ioctl(struct inode *inode, flags = REISERFS_I(inode)->i_attrs; i_attrs_to_sd_attrs(inode, (__u16 *) & flags); + flags &= REISERFS_FL_USER_VISIBLE; return put_user(flags, (int __user *)arg); case REISERFS_IOC_SETFLAGS:{ if (!reiserfs_attrs(inode->i_sb)) --- linux-2.6.14/fs/reiserfs/ioctl.c 2005-08-29 22:25:33 +0200 +++ linux-2.6.14-vs2.0.1-pre3/fs/reiserfs/ioctl.c 2005-10-30 04:29:36 +0100 @@ -56,10 +57,12 @@ int reiserfs_ioctl(struct inode *inode, if (get_user(flags, (int __user *)arg)) return -EFAULT; - if (((flags ^ REISERFS_I(inode)-> - i_attrs) & (REISERFS_IMMUTABLE_FL | - REISERFS_APPEND_FL)) - && !capable(CAP_LINUX_IMMUTABLE)) + oldflags = REISERFS_I(inode) -> i_attrs; + if (((oldflags & REISERFS_IMMUTABLE_FL) || + ((flags ^ oldflags) & + (REISERFS_IMMUTABLE_FL | REISERFS_IUNLINK_FL | + REISERFS_APPEND_FL))) && + !capable(CAP_LINUX_IMMUTABLE)) return -EPERM; if ((flags & REISERFS_NOTAIL_FL) && --- linux-2.6.14/fs/reiserfs/ioctl.c 2005-08-29 22:25:33 +0200 +++ linux-2.6.14-vs2.0.1-pre3/fs/reiserfs/ioctl.c 2005-10-30 04:29:36 +0100 @@ -70,6 +73,9 @@ int reiserfs_ioctl(struct inode *inode, if (result) return result; } + + flags = flags & REISERFS_FL_USER_MODIFIABLE; + flags |= oldflags & ~REISERFS_FL_USER_MODIFIABLE; sd_attrs_to_i_attrs(flags, inode); REISERFS_I(inode)->i_attrs = flags; inode->i_ctime = CURRENT_TIME_SEC; --- linux-2.6.14/fs/xfs/linux-2.6/xfs_ioctl.c 2005-10-28 20:49:45 +0200 +++ linux-2.6.14-vs2.0.1-pre3/fs/xfs/linux-2.6/xfs_ioctl.c 2005-10-29 03:19:02 +0200 @@ -1113,6 +1113,8 @@ xfs_ioc_fsgeometry( #define LINUX_XFLAG_APPEND 0x00000020 /* writes to file may only append */ #define LINUX_XFLAG_NODUMP 0x00000040 /* do not dump file */ #define LINUX_XFLAG_NOATIME 0x00000080 /* do not update atime */ +#define LINUX_XFLAG_BARRIER 0x04000000 /* chroot() barrier */ +#define LINUX_XFLAG_IUNLINK 0x08000000 /* immutable unlink */ STATIC unsigned int xfs_merge_ioc_xflags( --- linux-2.6.14/fs/xfs/linux-2.6/xfs_ioctl.c 2005-10-28 20:49:45 +0200 +++ linux-2.6.14-vs2.0.1-pre3/fs/xfs/linux-2.6/xfs_ioctl.c 2005-10-29 03:19:02 +0200 @@ -1153,6 +1155,10 @@ xfs_di2lxflags( if (di_flags & XFS_DIFLAG_IMMUTABLE) flags |= LINUX_XFLAG_IMMUTABLE; + if (di_flags & XFS_DIFLAG_IUNLINK) + flags |= LINUX_XFLAG_IUNLINK; + if (di_flags & XFS_DIFLAG_BARRIER) + flags |= LINUX_XFLAG_BARRIER; if (di_flags & XFS_DIFLAG_APPEND) flags |= LINUX_XFLAG_APPEND; if (di_flags & XFS_DIFLAG_SYNC) --- linux-2.6.14/fs/xfs/linux-2.6/xfs_iops.c 2005-10-28 20:49:45 +0200 +++ linux-2.6.14-vs2.0.1-pre3/fs/xfs/linux-2.6/xfs_iops.c 2005-10-29 15:38:05 +0200 @@ -471,6 +473,28 @@ linvfs_getattr( } STATIC int +linvfs_setattr_flags( + vattr_t *vap, + unsigned int flags) +{ + unsigned int oldflags, newflags; + + oldflags = vap->va_xflags; + newflags = oldflags & ~(XFS_XFLAG_IMMUTABLE | + XFS_XFLAG_IUNLINK | XFS_XFLAG_BARRIER); + if (flags & ATTR_FLAG_IMMUTABLE) + newflags |= XFS_XFLAG_IMMUTABLE; + if (flags & ATTR_FLAG_IUNLINK) + newflags |= XFS_XFLAG_IUNLINK; + if (flags & ATTR_FLAG_BARRIER) + newflags |= XFS_XFLAG_BARRIER; + + if (oldflags ^ newflags) + vap->va_xflags = newflags; + return 0; +} + +STATIC int linvfs_setattr( struct dentry *dentry, struct iattr *attr) --- linux-2.6.14/fs/xfs/linux-2.6/xfs_iops.c 2005-10-28 20:49:45 +0200 +++ linux-2.6.14-vs2.0.1-pre3/fs/xfs/linux-2.6/xfs_iops.c 2005-10-29 15:38:05 +0200 @@ -521,6 +553,11 @@ linvfs_setattr( flags |= ATTR_NONBLOCK; #endif + if (ia_valid & ATTR_ATTR_FLAG) { + vattr.va_mask |= XFS_AT_XFLAGS; + linvfs_setattr_flags(&vattr, attr->ia_attr_flags); + } + VOP_SETATTR(vp, &vattr, flags, NULL, error); if (error) return -error; --- linux-2.6.14/fs/xfs/linux-2.6/xfs_super.c 2005-10-28 20:49:45 +0200 +++ linux-2.6.14-vs2.0.1-pre3/fs/xfs/linux-2.6/xfs_super.c 2005-10-30 04:29:36 +0100 @@ -204,6 +205,14 @@ xfs_revalidate_inode( inode->i_flags |= S_IMMUTABLE; else inode->i_flags &= ~S_IMMUTABLE; + if (ip->i_d.di_flags & XFS_DIFLAG_IUNLINK) + inode->i_flags |= S_IUNLINK; + else + inode->i_flags &= ~S_IUNLINK; + if (ip->i_d.di_flags & XFS_DIFLAG_BARRIER) + inode->i_flags |= S_BARRIER; + else + inode->i_flags &= ~S_BARRIER; if (ip->i_d.di_flags & XFS_DIFLAG_APPEND) inode->i_flags |= S_APPEND; else --- linux-2.6.14/fs/xfs/linux-2.6/xfs_vnode.c 2005-10-28 20:49:45 +0200 +++ linux-2.6.14-vs2.0.1-pre3/fs/xfs/linux-2.6/xfs_vnode.c 2005-10-29 04:22:54 +0200 @@ -128,6 +129,14 @@ vn_revalidate_core( inode->i_flags |= S_IMMUTABLE; else inode->i_flags &= ~S_IMMUTABLE; + if (vap->va_xflags & XFS_XFLAG_IUNLINK) + inode->i_flags |= S_IUNLINK; + else + inode->i_flags &= ~S_IUNLINK; + if (vap->va_xflags & XFS_XFLAG_BARRIER) + inode->i_flags |= S_BARRIER; + else + inode->i_flags &= ~S_BARRIER; if (vap->va_xflags & XFS_XFLAG_APPEND) inode->i_flags |= S_APPEND; else --- linux-2.6.14/fs/xfs/xfs_dinode.h 2005-06-22 02:38:40 +0200 +++ linux-2.6.14-vs2.0.1-pre3/fs/xfs/xfs_dinode.h 2005-10-29 04:22:54 +0200 @@ -397,6 +398,9 @@ xfs_dinode_t *xfs_buf_to_dinode(struct x #define XFS_DIFLAG_RTINHERIT_BIT 8 /* create with realtime bit set */ #define XFS_DIFLAG_PROJINHERIT_BIT 9 /* create with parents projid */ #define XFS_DIFLAG_NOSYMLINKS_BIT 10 /* disallow symlink creation */ +#define XFS_DIFLAG_BARRIER_BIT 12 /* chroot() barrier */ +#define XFS_DIFLAG_IUNLINK_BIT 13 /* immutable unlink */ + #define XFS_DIFLAG_REALTIME (1 << XFS_DIFLAG_REALTIME_BIT) #define XFS_DIFLAG_PREALLOC (1 << XFS_DIFLAG_PREALLOC_BIT) #define XFS_DIFLAG_NEWRTBM (1 << XFS_DIFLAG_NEWRTBM_BIT) --- linux-2.6.14/fs/xfs/xfs_dinode.h 2005-06-22 02:38:40 +0200 +++ linux-2.6.14-vs2.0.1-pre3/fs/xfs/xfs_dinode.h 2005-10-29 04:22:54 +0200 @@ -408,11 +412,15 @@ xfs_dinode_t *xfs_buf_to_dinode(struct x #define XFS_DIFLAG_RTINHERIT (1 << XFS_DIFLAG_RTINHERIT_BIT) #define XFS_DIFLAG_PROJINHERIT (1 << XFS_DIFLAG_PROJINHERIT_BIT) #define XFS_DIFLAG_NOSYMLINKS (1 << XFS_DIFLAG_NOSYMLINKS_BIT) +#define XFS_DIFLAG_BARRIER (1 << XFS_DIFLAG_BARRIER_BIT) +#define XFS_DIFLAG_IUNLINK (1 << XFS_DIFLAG_IUNLINK_BIT) + #define XFS_DIFLAG_ANY \ (XFS_DIFLAG_REALTIME | XFS_DIFLAG_PREALLOC | XFS_DIFLAG_NEWRTBM | \ XFS_DIFLAG_IMMUTABLE | XFS_DIFLAG_APPEND | XFS_DIFLAG_SYNC | \ XFS_DIFLAG_NOATIME | XFS_DIFLAG_NODUMP | XFS_DIFLAG_RTINHERIT | \ - XFS_DIFLAG_PROJINHERIT | XFS_DIFLAG_NOSYMLINKS) + XFS_DIFLAG_PROJINHERIT | XFS_DIFLAG_NOSYMLINKS | \ + XFS_DIFLAG_BARRIER | XFS_DIFLAG_IUNLINK) #endif /* __XFS_DINODE_H__ */ --- linux-2.6.14/fs/xfs/xfs_fs.h 2005-08-29 22:25:34 +0200 +++ linux-2.6.14-vs2.0.1-pre3/fs/xfs/xfs_fs.h 2005-10-29 04:22:54 +0200 @@ -80,6 +80,8 @@ struct fsxattr { #define XFS_XFLAG_RTINHERIT 0x00000100 /* create with rt bit set */ #define XFS_XFLAG_PROJINHERIT 0x00000200 /* create with parents projid */ #define XFS_XFLAG_NOSYMLINKS 0x00000400 /* disallow symlink creation */ +#define XFS_XFLAG_BARRIER 0x00004000 /* chroot() barrier */ +#define XFS_XFLAG_IUNLINK 0x00008000 /* immutable unlink */ #define XFS_XFLAG_HASATTR 0x80000000 /* no DIFLAG for this */ /* --- linux-2.6.14/fs/xfs/xfs_inode.c 2005-10-28 20:49:45 +0200 +++ linux-2.6.14-vs2.0.1-pre3/fs/xfs/xfs_inode.c 2005-10-29 04:22:54 +0200 @@ -809,6 +825,10 @@ _xfs_dic2xflags( flags |= XFS_XFLAG_PREALLOC; if (di_flags & XFS_DIFLAG_IMMUTABLE) flags |= XFS_XFLAG_IMMUTABLE; + if (di_flags & XFS_DIFLAG_IUNLINK) + flags |= XFS_XFLAG_IUNLINK; + if (di_flags & XFS_DIFLAG_BARRIER) + flags |= XFS_XFLAG_BARRIER; if (di_flags & XFS_DIFLAG_APPEND) flags |= XFS_XFLAG_APPEND; if (di_flags & XFS_DIFLAG_SYNC) --- linux-2.6.14/fs/xfs/xfs_vnodeops.c 2005-10-28 20:49:46 +0200 +++ linux-2.6.14-vs2.0.1-pre3/fs/xfs/xfs_vnodeops.c 2005-10-29 04:22:54 +0200 @@ -851,6 +865,10 @@ xfs_setattr( di_flags = (ip->i_d.di_flags & XFS_DIFLAG_PREALLOC); if (vap->va_xflags & XFS_XFLAG_IMMUTABLE) di_flags |= XFS_DIFLAG_IMMUTABLE; + if (vap->va_xflags & XFS_XFLAG_IUNLINK) + di_flags |= XFS_DIFLAG_IUNLINK; + if (vap->va_xflags & XFS_XFLAG_BARRIER) + di_flags |= XFS_DIFLAG_BARRIER; if (vap->va_xflags & XFS_XFLAG_APPEND) di_flags |= XFS_DIFLAG_APPEND; if (vap->va_xflags & XFS_XFLAG_SYNC) --- linux-2.6.14/include/linux/ext2_fs.h 2005-10-28 20:49:54 +0200 +++ linux-2.6.14-vs2.0.1-pre3/include/linux/ext2_fs.h 2005-10-29 04:27:48 +0200 @@ -192,10 +192,17 @@ struct ext2_group_desc #define EXT2_NOTAIL_FL 0x00008000 /* file tail should not be merged */ #define EXT2_DIRSYNC_FL 0x00010000 /* dirsync behaviour (directories only) */ #define EXT2_TOPDIR_FL 0x00020000 /* Top of directory hierarchies*/ +#define EXT2_BARRIER_FL 0x04000000 /* Barrier for chroot() */ +#define EXT2_IUNLINK_FL 0x08000000 /* Immutable unlink */ #define EXT2_RESERVED_FL 0x80000000 /* reserved for ext2 lib */ +#ifdef CONFIG_VSERVER_LEGACY +#define EXT2_FL_USER_VISIBLE 0x0803DFFF /* User visible flags */ +#define EXT2_FL_USER_MODIFIABLE 0x080380FF /* User modifiable flags */ +#else #define EXT2_FL_USER_VISIBLE 0x0003DFFF /* User visible flags */ #define EXT2_FL_USER_MODIFIABLE 0x000380FF /* User modifiable flags */ +#endif /* * ioctl commands --- linux-2.6.14/include/linux/ext3_fs.h 2005-10-28 20:49:54 +0200 +++ linux-2.6.14-vs2.0.1-pre3/include/linux/ext3_fs.h 2005-10-29 04:28:52 +0200 @@ -185,10 +185,20 @@ struct ext3_group_desc #define EXT3_NOTAIL_FL 0x00008000 /* file tail should not be merged */ #define EXT3_DIRSYNC_FL 0x00010000 /* dirsync behaviour (directories only) */ #define EXT3_TOPDIR_FL 0x00020000 /* Top of directory hierarchies*/ +#define EXT3_BARRIER_FL 0x04000000 /* Barrier for chroot() */ +#define EXT3_IUNLINK_FL 0x08000000 /* Immutable unlink */ #define EXT3_RESERVED_FL 0x80000000 /* reserved for ext3 lib */ +#ifdef CONFIG_VSERVER_LEGACY +#define EXT3_FL_USER_VISIBLE 0x0803DFFF /* User visible flags */ +#define EXT3_FL_USER_MODIFIABLE 0x080380FF /* User modifiable flags */ +#else #define EXT3_FL_USER_VISIBLE 0x0003DFFF /* User visible flags */ #define EXT3_FL_USER_MODIFIABLE 0x000380FF /* User modifiable flags */ +#endif +#ifdef CONFIG_VSERVER_LEGACY +#define EXT3_IOC_SETXID FIOC_SETXIDJ +#endif /* * Inode dynamic state flags --- linux-2.6.14/include/linux/fs.h 2005-10-28 20:49:54 +0200 +++ linux-2.6.14-vs2.0.1-pre3/include/linux/fs.h 2005-10-30 04:30:05 +0100 @@ -132,6 +134,8 @@ extern int dir_notify_enable; #define S_NOCMTIME 128 /* Do not update file c/mtime */ #define S_SWAPFILE 256 /* Do not truncate: swapon got its bmaps */ #define S_PRIVATE 512 /* Inode is fs-internal */ +#define S_BARRIER 1024 /* Barrier for chroot() */ +#define S_IUNLINK 2048 /* Immutable unlink */ /* * Note that nosuid etc flags are inode-specific: setting some file-system --- linux-2.6.14/include/linux/fs.h 2005-10-28 20:49:54 +0200 +++ linux-2.6.14-vs2.0.1-pre3/include/linux/fs.h 2005-10-30 04:30:05 +0100 @@ -154,14 +158,18 @@ extern int dir_notify_enable; #define IS_DIRSYNC(inode) (__IS_FLG(inode, MS_SYNCHRONOUS|MS_DIRSYNC) || \ ((inode)->i_flags & (S_SYNC|S_DIRSYNC))) #define IS_MANDLOCK(inode) __IS_FLG(inode, MS_MANDLOCK) +#define IS_TAGXID(inode) __IS_FLG(inode, MS_TAGXID) #define IS_NOQUOTA(inode) ((inode)->i_flags & S_NOQUOTA) #define IS_APPEND(inode) ((inode)->i_flags & S_APPEND) #define IS_IMMUTABLE(inode) ((inode)->i_flags & S_IMMUTABLE) +#define IS_IUNLINK(inode) ((inode)->i_flags & S_IUNLINK) +#define IS_IXORUNLINK(inode) ((IS_IUNLINK(inode) ? S_IMMUTABLE : 0) ^ IS_IMMUTABLE(inode)) #define IS_NOATIME(inode) (__IS_FLG(inode, MS_NOATIME) || ((inode)->i_flags & S_NOATIME)) #define IS_NODIRATIME(inode) __IS_FLG(inode, MS_NODIRATIME) #define IS_POSIXACL(inode) __IS_FLG(inode, MS_POSIXACL) +#define IS_BARRIER(inode) (S_ISDIR((inode)->i_mode) && ((inode)->i_flags & S_BARRIER)) #define IS_DEADDIR(inode) ((inode)->i_flags & S_DEAD) #define IS_NOCMTIME(inode) ((inode)->i_flags & S_NOCMTIME) #define IS_SWAPFILE(inode) ((inode)->i_flags & S_SWAPFILE) --- linux-2.6.14/include/linux/reiserfs_fs.h 2005-10-28 20:49:56 +0200 +++ linux-2.6.14-vs2.0.1-pre3/include/linux/reiserfs_fs.h 2005-10-29 03:19:02 +0200 @@ -829,6 +829,18 @@ struct stat_data_v1 { #define REISERFS_COMPR_FL EXT2_COMPR_FL #define REISERFS_NOTAIL_FL EXT2_NOTAIL_FL +/* unfortunately reiserfs sdattr is only 16 bit */ +#define REISERFS_BARRIER_FL (EXT2_BARRIER_FL >> 16) +#define REISERFS_IUNLINK_FL (EXT2_IUNLINK_FL >> 16) + +#ifdef CONFIG_VSERVER_LEGACY +#define REISERFS_FL_USER_VISIBLE (REISERFS_IUNLINK_FL|0x80FF) +#define REISERFS_FL_USER_MODIFIABLE (REISERFS_IUNLINK_FL|0x80FF) +#else +#define REISERFS_FL_USER_VISIBLE 0x80FF +#define REISERFS_FL_USER_MODIFIABLE 0x80FF +#endif + /* persistent flags that file inherits from the parent directory */ #define REISERFS_INHERIT_MASK ( REISERFS_IMMUTABLE_FL | \ REISERFS_SYNC_FL | \