--- olpc-2.6-master.00/fs/ocfs2/dlm/dlmfs.c 2007-02-28 20:05:28.000000000 -0500 +++ olpc-2.6-master-vs22x.02/fs/ocfs2/dlm/dlmfs.c 2007-03-01 11:52:20.000000000 -0500 @@ -335,6 +336,7 @@ static struct inode *dlmfs_get_root_inod inode->i_mode = mode; inode->i_uid = current->fsuid; inode->i_gid = current->fsgid; + inode->i_tag = dx_current_fstag(sb); inode->i_blocks = 0; inode->i_mapping->backing_dev_info = &dlmfs_backing_dev_info; inode->i_atime = inode->i_mtime = inode->i_ctime = CURRENT_TIME; --- olpc-2.6-master.00/fs/ocfs2/dlm/dlmfs.c 2007-02-28 20:05:28.000000000 -0500 +++ olpc-2.6-master-vs22x.02/fs/ocfs2/dlm/dlmfs.c 2007-03-01 11:52:20.000000000 -0500 @@ -361,6 +363,7 @@ static struct inode *dlmfs_get_inode(str inode->i_mode = mode; inode->i_uid = current->fsuid; inode->i_gid = current->fsgid; + inode->i_tag = dx_current_fstag(sb); inode->i_blocks = 0; inode->i_mapping->backing_dev_info = &dlmfs_backing_dev_info; inode->i_atime = inode->i_mtime = inode->i_ctime = CURRENT_TIME; --- olpc-2.6-master.00/fs/ocfs2/dlmglue.c 2007-02-28 20:05:28.000000000 -0500 +++ olpc-2.6-master-vs22x.02/fs/ocfs2/dlmglue.c 2007-03-01 11:52:20.000000000 -0500 @@ -1339,6 +1339,7 @@ static void __ocfs2_stuff_meta_lvb(struc lvb->lvb_iclusters = cpu_to_be32(oi->ip_clusters); lvb->lvb_iuid = cpu_to_be32(inode->i_uid); lvb->lvb_igid = cpu_to_be32(inode->i_gid); + lvb->lvb_itag = cpu_to_be16(inode->i_tag); lvb->lvb_imode = cpu_to_be16(inode->i_mode); lvb->lvb_inlink = cpu_to_be16(inode->i_nlink); lvb->lvb_iatime_packed = --- olpc-2.6-master.00/fs/ocfs2/dlmglue.c 2007-02-28 20:05:28.000000000 -0500 +++ olpc-2.6-master-vs22x.02/fs/ocfs2/dlmglue.c 2007-03-01 11:52:20.000000000 -0500 @@ -1392,6 +1393,7 @@ static void ocfs2_refresh_inode_from_lvb inode->i_uid = be32_to_cpu(lvb->lvb_iuid); inode->i_gid = be32_to_cpu(lvb->lvb_igid); + inode->i_tag = be16_to_cpu(lvb->lvb_itag); inode->i_mode = be16_to_cpu(lvb->lvb_imode); inode->i_nlink = be16_to_cpu(lvb->lvb_inlink); ocfs2_unpack_timespec(&inode->i_atime, --- olpc-2.6-master.00/fs/ocfs2/dlmglue.h 2007-02-28 20:05:28.000000000 -0500 +++ olpc-2.6-master-vs22x.02/fs/ocfs2/dlmglue.h 2007-03-01 11:52:20.000000000 -0500 @@ -34,7 +34,7 @@ struct ocfs2_meta_lvb { __u8 lvb_version; __u8 lvb_reserved0; - __be16 lvb_reserved1; + __be16 lvb_itag; __be32 lvb_iclusters; __be32 lvb_iuid; __be32 lvb_igid; --- olpc-2.6-master.00/fs/ocfs2/file.c 2007-02-28 20:05:28.000000000 -0500 +++ olpc-2.6-master-vs22x.02/fs/ocfs2/file.c 2007-03-01 11:52:20.000000000 -0500 @@ -864,7 +866,7 @@ ***** mlog(0, "time change...\n"); #define OCFS2_VALID_ATTRS (ATTR_ATIME | ATTR_MTIME | ATTR_CTIME | ATTR_SIZE \ - | ATTR_GID | ATTR_UID | ATTR_MODE) + | ATTR_GID | ATTR_UID | ATTR_TAG | ATTR_MODE) if (!(attr->ia_valid & OCFS2_VALID_ATTRS)) { mlog(0, "can't handle attrs: 0x%x\n", attr->ia_valid); return 0; --- olpc-2.6-master.00/fs/ocfs2/inode.c 2007-02-28 20:05:28.000000000 -0500 +++ olpc-2.6-master-vs22x.02/fs/ocfs2/inode.c 2007-03-01 11:52:20.000000000 -0500 @@ -78,6 +80,10 @@ void ocfs2_set_inode_flags(struct inode if (flags & OCFS2_IMMUTABLE_FL) inode->i_flags |= S_IMMUTABLE; + if (flags & OCFS2_IUNLINK_FL) + inode->i_flags |= S_IUNLINK; + if (flags & OCFS2_BARRIER_FL) + inode->i_flags |= S_BARRIER; if (flags & OCFS2_SYNC_FL) inode->i_flags |= S_SYNC; --- olpc-2.6-master.00/fs/ocfs2/inode.c 2007-02-28 20:05:28.000000000 -0500 +++ olpc-2.6-master-vs22x.02/fs/ocfs2/inode.c 2007-03-01 11:52:20.000000000 -0500 @@ -89,6 +95,27 @@ void ocfs2_set_inode_flags(struct inode inode->i_flags |= S_DIRSYNC; } +int ocfs2_sync_flags(struct inode *inode) +{ + unsigned int oldflags, newflags; + + oldflags = OCFS2_I(inode)->ip_flags; + newflags = oldflags & ~(OCFS2_IMMUTABLE_FL | + OCFS2_IUNLINK_FL | OCFS2_BARRIER_FL); + + if (IS_IMMUTABLE(inode)) + newflags |= OCFS2_IMMUTABLE_FL; + if (IS_IUNLINK(inode)) + newflags |= OCFS2_IUNLINK_FL; + if (IS_BARRIER(inode)) + newflags |= OCFS2_BARRIER_FL; + + if (oldflags ^ newflags) + return ocfs2_set_inode_attr(inode, + newflags, OCFS2_FL_MASK); + return 0; +} + struct inode *ocfs2_ilookup_for_vote(struct ocfs2_super *osb, u64 blkno, int delete_vote) --- olpc-2.6-master.00/fs/ocfs2/inode.c 2007-02-28 20:05:28.000000000 -0500 +++ olpc-2.6-master-vs22x.02/fs/ocfs2/inode.c 2007-03-01 11:52:20.000000000 -0500 @@ -234,6 +261,8 @@ int ocfs2_populate_inode(struct inode *i struct super_block *sb; struct ocfs2_super *osb; int status = -EINVAL; + uid_t uid; + gid_t gid; mlog_entry("(0x%p, size:%llu)\n", inode, (unsigned long long)fe->i_size); --- olpc-2.6-master.00/fs/ocfs2/inode.c 2007-02-28 20:05:28.000000000 -0500 +++ olpc-2.6-master-vs22x.02/fs/ocfs2/inode.c 2007-03-01 11:52:20.000000000 -0500 @@ -1246,6 +1282,9 @@ leave: void ocfs2_refresh_inode(struct inode *inode, struct ocfs2_dinode *fe) { + uid_t uid; + gid_t gid; + spin_lock(&OCFS2_I(inode)->ip_lock); OCFS2_I(inode)->ip_clusters = le32_to_cpu(fe->i_clusters); --- olpc-2.6-master.00/fs/ocfs2/inode.c 2007-02-28 20:05:28.000000000 -0500 +++ olpc-2.6-master-vs22x.02/fs/ocfs2/inode.c 2007-03-01 11:52:20.000000000 -0500 @@ -1250,6 +1289,8 @@ ***** OCFS2_I(inode)->ip_clusters = le32_to_cpu(fe->i_clusters); OCFS2_I(inode)->ip_attr = le32_to_cpu(fe->i_attr); + /* OCFS2_I(inode)->ip_flags &= ~OCFS2_FL_MASK; + OCFS2_I(inode)->ip_flags |= le32_to_cpu(fe->i_flags) & OCFS2_FL_MASK; */ ocfs2_set_inode_flags(inode); i_size_write(inode, le64_to_cpu(fe->i_size)); inode->i_nlink = le16_to_cpu(fe->i_links_count); --- olpc-2.6-master.00/fs/ocfs2/ioctl.c 2007-02-28 20:05:28.000000000 -0500 +++ olpc-2.6-master-vs22x.02/fs/ocfs2/ioctl.c 2007-03-01 11:52:20.000000000 -0500 @@ -38,7 +38,7 @@ static int ocfs2_get_inode_attr(struct i return status; } -static int ocfs2_set_inode_attr(struct inode *inode, unsigned flags, +int ocfs2_set_inode_attr(struct inode *inode, unsigned flags, unsigned mask) { struct ocfs2_inode_info *ocfs2_inode = OCFS2_I(inode); --- olpc-2.6-master.00/fs/ocfs2/ioctl.h 2007-02-28 20:05:28.000000000 -0500 +++ olpc-2.6-master-vs22x.02/fs/ocfs2/ioctl.h 2007-03-01 11:52:20.000000000 -0500 @@ -10,6 +10,9 @@ #ifndef OCFS2_IOCTL_H #define OCFS2_IOCTL_H +int ocfs2_set_inode_attr(struct inode *inode, unsigned flags, + unsigned mask); + int ocfs2_ioctl(struct inode * inode, struct file * filp, unsigned int cmd, unsigned long arg); --- olpc-2.6-master.00/fs/ocfs2/namei.c 2007-02-28 20:05:28.000000000 -0500 +++ olpc-2.6-master-vs22x.02/fs/ocfs2/namei.c 2007-03-01 11:52:20.000000000 -0500 @@ -486,6 +487,9 @@ static int ocfs2_mknod_locked(struct ocf u64 fe_blkno = 0; u16 suballoc_bit; struct inode *inode = NULL; + uid_t uid; + gid_t gid; + tag_t tag; mlog_entry("(0x%p, 0x%p, %d, %lu, '%.*s')\n", dir, dentry, mode, (unsigned long)dev, dentry->d_name.len, --- olpc-2.6-master.00/fs/ocfs2/namei.c 2007-02-28 20:05:28.000000000 -0500 +++ olpc-2.6-master-vs22x.02/fs/ocfs2/namei.c 2007-03-01 11:52:20.000000000 -0500 @@ -545,9 +549,11 @@ static int ocfs2_mknod_locked(struct ocf fe->i_blkno = cpu_to_le64(fe_blkno); fe->i_suballoc_bit = cpu_to_le16(suballoc_bit); fe->i_suballoc_slot = cpu_to_le16(osb->slot_num); - fe->i_uid = cpu_to_le32(current->fsuid); + + tag = dx_current_fstag(osb->sb); + uid = current->fsuid; if (dir->i_mode & S_ISGID) { - fe->i_gid = cpu_to_le32(dir->i_gid); + gid = dir->i_gid; if (S_ISDIR(mode)) mode |= S_ISGID; } else --- olpc-2.6-master.00/fs/ocfs2/ocfs2_fs.h 2007-02-28 20:05:28.000000000 -0500 +++ olpc-2.6-master-vs22x.02/fs/ocfs2/ocfs2_fs.h 2007-03-01 11:52:20.000000000 -0500 @@ -151,8 +151,12 @@ #define OCFS2_NOATIME_FL (0x00000080) /* do not update atime */ #define OCFS2_DIRSYNC_FL (0x00010000) /* dirsync behaviour (directories only) */ +#define OCFS2_BARRIER_FL (0x04000000) /* Barrier for chroot() */ +#define OCFS2_IUNLINK_FL (0x08000000) /* Immutable unlink */ + #define OCFS2_FL_VISIBLE (0x000100FF) /* User visible flags */ #define OCFS2_FL_MODIFIABLE (0x000100FF) /* User modifiable flags */ +#define OCFS2_FL_MASK (0x0F0100FF) /* * ioctl commands --- olpc-2.6-master.00/fs/ocfs2/ocfs2.h 2007-02-28 20:05:28.000000000 -0500 +++ olpc-2.6-master-vs22x.02/fs/ocfs2/ocfs2.h 2007-03-01 11:52:20.000000000 -0500 @@ -175,6 +175,7 @@ enum ocfs2_mount_options OCFS2_MOUNT_NOINTR = 1 << 2, /* Don't catch signals */ OCFS2_MOUNT_ERRORS_PANIC = 1 << 3, /* Panic on errors */ OCFS2_MOUNT_DATA_WRITEBACK = 1 << 4, /* No data ordering */ + OCFS2_MOUNT_TAGGED = 1 << 8, /* use tagging */ }; #define OCFS2_OSB_SOFT_RO 0x0001 --- olpc-2.6-master.00/fs/ocfs2/super.c 2007-02-28 20:05:28.000000000 -0500 +++ olpc-2.6-master-vs22x.02/fs/ocfs2/super.c 2007-03-01 11:52:20.000000000 -0500 @@ -154,6 +155,10 @@ static match_table_t tokens = { {Opt_data_ordered, "data=ordered"}, {Opt_data_writeback, "data=writeback"}, {Opt_atime_quantum, "atime_quantum=%u"}, + {Opt_tag, "tag"}, + {Opt_tag, "tagxid"}, + {Opt_notag, "notag"}, + {Opt_tagid, "tagid=%u"}, {Opt_err, NULL} }; --- olpc-2.6-master.00/fs/ocfs2/super.c 2007-02-28 20:05:28.000000000 -0500 +++ olpc-2.6-master-vs22x.02/fs/ocfs2/super.c 2007-03-01 11:52:20.000000000 -0500 @@ -362,6 +367,14 @@ static int ocfs2_remount(struct super_bl goto out; } + printk("ocfs2_remount: %lx,%lx\n", osb->s_mount_opt, sb->s_flags); + if ((parsed_options & OCFS2_MOUNT_TAGGED) && + !(sb->s_flags & MS_TAGGED)) { + ret = -EINVAL; + mlog(ML_ERROR, "Cannot change tagging on remount\n"); + goto out; + } + if ((osb->s_mount_opt & OCFS2_MOUNT_HB_LOCAL) != (parsed_options & OCFS2_MOUNT_HB_LOCAL)) { ret = -EINVAL; --- olpc-2.6-master.00/fs/ocfs2/super.c 2007-02-28 20:05:28.000000000 -0500 +++ olpc-2.6-master-vs22x.02/fs/ocfs2/super.c 2007-03-01 11:52:20.000000000 -0500 @@ -654,6 +667,9 @@ static int ocfs2_fill_super(struct super ocfs2_complete_mount_recovery(osb); + if (osb->s_mount_opt & OCFS2_MOUNT_TAGGED) + sb->s_flags |= MS_TAGGED; + if (ocfs2_mount_local(osb)) snprintf(nodestr, sizeof(nodestr), "local"); else