gfs2: Automatically set GFS2_DIF_SYSTEM flag on system files
authorAbhi Das <adas@redhat.com>
Tue, 10 Nov 2015 21:07:26 +0000 (15:07 -0600)
committerBob Peterson <rpeterso@redhat.com>
Tue, 10 Nov 2015 21:11:06 +0000 (15:11 -0600)
When new files and directories are created inside a parent directory
we automatically inherit the GFS2_DIF_SYSTEM flag (if set) and assign
it to the new file/dirs.

All new system files/dirs created in the metafs by, say gfs2_jadd,
will have this flag set because they will have parent directories in
the metafs whose GFS2_DIF_SYSTEM flag has already been set (most likely
by a previous mkfs.gfs2)

Signed-off-by: Abhi Das <adas@redhat.com>
Signed-off-by: Bob Peterson <rpeterso@redhat.com>
fs/gfs2/file.c
fs/gfs2/inode.c

index 5e425469f0c2659b0475535b18c634e487b15e12..2012820466932dcba90684cbe7792bd9e2c40cfe 100644 (file)
@@ -298,9 +298,9 @@ static int gfs2_set_flags(struct file *filp, u32 __user *ptr)
                gfsflags &= ~GFS2_DIF_TOPDIR;
                if (gfsflags & GFS2_DIF_INHERIT_JDATA)
                        gfsflags ^= (GFS2_DIF_JDATA | GFS2_DIF_INHERIT_JDATA);
-               return do_gfs2_set_flags(filp, gfsflags, ~0);
+               return do_gfs2_set_flags(filp, gfsflags, ~GFS2_DIF_SYSTEM);
        }
-       return do_gfs2_set_flags(filp, gfsflags, ~GFS2_DIF_JDATA);
+       return do_gfs2_set_flags(filp, gfsflags, ~(GFS2_DIF_SYSTEM | GFS2_DIF_JDATA));
 }
 
 static long gfs2_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
index 063fdfcf82758a0c77f4cc44fe7b1f873b3cbb21..2c05bc3d19474676510d3e7fa29a5803f5150e58 100644 (file)
@@ -685,6 +685,11 @@ static int gfs2_create_inode(struct inode *dir, struct dentry *dentry,
                ip->i_entries = 2;
                break;
        }
+
+       /* Force SYSTEM flag on all files and subdirs of a SYSTEM directory */
+       if (dip->i_diskflags & GFS2_DIF_SYSTEM)
+               ip->i_diskflags |= GFS2_DIF_SYSTEM;
+
        gfs2_set_inode_flags(inode);
 
        if ((GFS2_I(d_inode(sdp->sd_root_dir)) == dip) ||
This page took 0.0266 seconds and 5 git commands to generate.