aboutsummaryrefslogtreecommitdiffstats
path: root/fs/gfs2
diff options
context:
space:
mode:
authorSteven Whitehouse <swhiteho@redhat.com>2011-06-16 09:06:55 -0400
committerSteven Whitehouse <swhiteho@redhat.com>2011-07-15 04:32:35 -0400
commit9964afbb797329e4c6e5d05ebc199c39af618c5f (patch)
treec0877e423f5dff8b722869bd3f21622a88889220 /fs/gfs2
parent7cf8dcd3b68a760d66fbc7f0d75d3fbb8f21775d (diff)
GFS2: Add S_NOSEC support
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>
Diffstat (limited to 'fs/gfs2')
-rw-r--r--fs/gfs2/file.c4
-rw-r--r--fs/gfs2/glops.c3
-rw-r--r--fs/gfs2/ops_fstype.c1
3 files changed, 6 insertions, 2 deletions
diff --git a/fs/gfs2/file.c b/fs/gfs2/file.c
index a9f5cbe45cd9..bc2590ef5fc1 100644
--- a/fs/gfs2/file.c
+++ b/fs/gfs2/file.c
@@ -174,7 +174,9 @@ void gfs2_set_inode_flags(struct inode *inode)
174 struct gfs2_inode *ip = GFS2_I(inode); 174 struct gfs2_inode *ip = GFS2_I(inode);
175 unsigned int flags = inode->i_flags; 175 unsigned int flags = inode->i_flags;
176 176
177 flags &= ~(S_SYNC|S_APPEND|S_IMMUTABLE|S_NOATIME|S_DIRSYNC); 177 flags &= ~(S_SYNC|S_APPEND|S_IMMUTABLE|S_NOATIME|S_DIRSYNC|S_NOSEC);
178 if ((ip->i_eattr == 0) && !is_sxid(inode->i_mode))
179 inode->i_flags |= S_NOSEC;
178 if (ip->i_diskflags & GFS2_DIF_IMMUTABLE) 180 if (ip->i_diskflags & GFS2_DIF_IMMUTABLE)
179 flags |= S_IMMUTABLE; 181 flags |= S_IMMUTABLE;
180 if (ip->i_diskflags & GFS2_DIF_APPENDONLY) 182 if (ip->i_diskflags & GFS2_DIF_APPENDONLY)
diff --git a/fs/gfs2/glops.c b/fs/gfs2/glops.c
index a4222c3f5993..da21ecaafcc2 100644
--- a/fs/gfs2/glops.c
+++ b/fs/gfs2/glops.c
@@ -318,6 +318,8 @@ static int gfs2_dinode_in(struct gfs2_inode *ip, const void *buf)
318 ip->i_generation = be64_to_cpu(str->di_generation); 318 ip->i_generation = be64_to_cpu(str->di_generation);
319 319
320 ip->i_diskflags = be32_to_cpu(str->di_flags); 320 ip->i_diskflags = be32_to_cpu(str->di_flags);
321 ip->i_eattr = be64_to_cpu(str->di_eattr);
322 /* i_diskflags and i_eattr must be set before gfs2_set_inode_flags() */
321 gfs2_set_inode_flags(&ip->i_inode); 323 gfs2_set_inode_flags(&ip->i_inode);
322 height = be16_to_cpu(str->di_height); 324 height = be16_to_cpu(str->di_height);
323 if (unlikely(height > GFS2_MAX_META_HEIGHT)) 325 if (unlikely(height > GFS2_MAX_META_HEIGHT))
@@ -330,7 +332,6 @@ static int gfs2_dinode_in(struct gfs2_inode *ip, const void *buf)
330 ip->i_depth = (u8)depth; 332 ip->i_depth = (u8)depth;
331 ip->i_entries = be32_to_cpu(str->di_entries); 333 ip->i_entries = be32_to_cpu(str->di_entries);
332 334
333 ip->i_eattr = be64_to_cpu(str->di_eattr);
334 if (S_ISREG(ip->i_inode.i_mode)) 335 if (S_ISREG(ip->i_inode.i_mode))
335 gfs2_set_aops(&ip->i_inode); 336 gfs2_set_aops(&ip->i_inode);
336 337
diff --git a/fs/gfs2/ops_fstype.c b/fs/gfs2/ops_fstype.c
index 2a77071fb7b6..516516e0c2a2 100644
--- a/fs/gfs2/ops_fstype.c
+++ b/fs/gfs2/ops_fstype.c
@@ -1094,6 +1094,7 @@ static int fill_super(struct super_block *sb, struct gfs2_args *args, int silent
1094 if (sdp->sd_args.ar_nobarrier) 1094 if (sdp->sd_args.ar_nobarrier)
1095 set_bit(SDF_NOBARRIERS, &sdp->sd_flags); 1095 set_bit(SDF_NOBARRIERS, &sdp->sd_flags);
1096 1096
1097 sb->s_flags |= MS_NOSEC;
1097 sb->s_magic = GFS2_MAGIC; 1098 sb->s_magic = GFS2_MAGIC;
1098 sb->s_op = &gfs2_super_ops; 1099 sb->s_op = &gfs2_super_ops;
1099 sb->s_d_op = &gfs2_dops; 1100 sb->s_d_op = &gfs2_dops;