Skip to content

Commit

Permalink
gfs2: Automatically set GFS2_DIF_SYSTEM flag on system files
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Abhi Das authored and Bob Peterson committed Nov 10, 2015
1 parent 42d4ebb commit acc546f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
4 changes: 2 additions & 2 deletions fs/gfs2/file.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
5 changes: 5 additions & 0 deletions fs/gfs2/inode.c
Original file line number Diff line number Diff line change
Expand Up @@ -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) ||
Expand Down

0 comments on commit acc546f

Please sign in to comment.