]> git.openfabrics.org - ~shefty/rdma-dev.git/commitdiff
GFS2: Add S_NOSEC support
authorSteven Whitehouse <swhiteho@redhat.com>
Thu, 16 Jun 2011 13:06:55 +0000 (14:06 +0100)
committerSteven Whitehouse <swhiteho@redhat.com>
Fri, 15 Jul 2011 08:32:35 +0000 (09:32 +0100)
This adds S_NOSEC support to GFS2. We set/reset the flag either when
a user calls setattr or when we have just regained the glock
from another node. The flag is only set if there are no xattrs
on the inode and there is no suid bit set.

Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
Reviewed-by: Andi Kleen <ak@linux.intel.com>
Cc: Al Viro <viro@ZenIV.linux.org.uk>
fs/gfs2/file.c
fs/gfs2/glops.c
fs/gfs2/ops_fstype.c

index a9f5cbe45cd976de463c094cc49f721b849c5c24..bc2590ef5fc1303b1d02f66170102ea6f0ac1b70 100644 (file)
@@ -174,7 +174,9 @@ void gfs2_set_inode_flags(struct inode *inode)
        struct gfs2_inode *ip = GFS2_I(inode);
        unsigned int flags = inode->i_flags;
 
-       flags &= ~(S_SYNC|S_APPEND|S_IMMUTABLE|S_NOATIME|S_DIRSYNC);
+       flags &= ~(S_SYNC|S_APPEND|S_IMMUTABLE|S_NOATIME|S_DIRSYNC|S_NOSEC);
+       if ((ip->i_eattr == 0) && !is_sxid(inode->i_mode))
+               inode->i_flags |= S_NOSEC;
        if (ip->i_diskflags & GFS2_DIF_IMMUTABLE)
                flags |= S_IMMUTABLE;
        if (ip->i_diskflags & GFS2_DIF_APPENDONLY)
index a4222c3f59934bad988c71ede59efc62aa79935c..da21ecaafcc2725e4cbff9ee3a469f237f2e31b2 100644 (file)
@@ -318,6 +318,8 @@ static int gfs2_dinode_in(struct gfs2_inode *ip, const void *buf)
        ip->i_generation = be64_to_cpu(str->di_generation);
 
        ip->i_diskflags = be32_to_cpu(str->di_flags);
+       ip->i_eattr = be64_to_cpu(str->di_eattr);
+       /* i_diskflags and i_eattr must be set before gfs2_set_inode_flags() */
        gfs2_set_inode_flags(&ip->i_inode);
        height = be16_to_cpu(str->di_height);
        if (unlikely(height > GFS2_MAX_META_HEIGHT))
@@ -330,7 +332,6 @@ static int gfs2_dinode_in(struct gfs2_inode *ip, const void *buf)
        ip->i_depth = (u8)depth;
        ip->i_entries = be32_to_cpu(str->di_entries);
 
-       ip->i_eattr = be64_to_cpu(str->di_eattr);
        if (S_ISREG(ip->i_inode.i_mode))
                gfs2_set_aops(&ip->i_inode);
 
index 2a77071fb7b68df78c3ff41041bf1d7fb330985c..516516e0c2a2d6ac0bc7bff9e511755a6e660cb1 100644 (file)
@@ -1094,6 +1094,7 @@ static int fill_super(struct super_block *sb, struct gfs2_args *args, int silent
        if (sdp->sd_args.ar_nobarrier)
                set_bit(SDF_NOBARRIERS, &sdp->sd_flags);
 
+       sb->s_flags |= MS_NOSEC;
        sb->s_magic = GFS2_MAGIC;
        sb->s_op = &gfs2_super_ops;
        sb->s_d_op = &gfs2_dops;