From mboxrd@z Thu Jan 1 00:00:00 1970 From: Andrew Price Date: Thu, 5 Nov 2015 19:03:14 +0000 Subject: [Cluster-devel] [GFS2 PATCH] gfs2: Automatically set GFS2_DIF_SYSTEM flag on system files In-Reply-To: <590030517.5073928.1446748809867.JavaMail.zimbra@redhat.com> References: <1446235068-23072-1-git-send-email-adas@redhat.com> <563B9DC4.3040403@redhat.com> <590030517.5073928.1446748809867.JavaMail.zimbra@redhat.com> Message-ID: <563BA7F2.8030909@redhat.com> List-Id: To: cluster-devel.redhat.com MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit On 05/11/15 18:40, Abhijith Das wrote: > Hi Andy, > > ----- Original Message ----- >> From: "Andrew Price" >> To: "Abhi Das" , cluster-devel at redhat.com >> Sent: Thursday, November 5, 2015 12:19:48 PM >> Subject: Re: [Cluster-devel] [GFS2 PATCH] gfs2: Automatically set GFS2_DIF_SYSTEM flag on system files >> >> Hi Abhi, >> >> On 30/10/15 19:57, Abhi Das wrote: >>> 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) >>> >>> Resolves: rhbz#1272086 >>> Signed-off-by: Abhi Das >>> --- >>> fs/gfs2/file.c | 4 ++-- >>> fs/gfs2/inode.c | 5 +++++ >>> 2 files changed, 7 insertions(+), 2 deletions(-) >>> >>> diff --git a/fs/gfs2/file.c b/fs/gfs2/file.c >>> index 71cd138..63fe948 100644 >>> --- a/fs/gfs2/file.c >>> +++ b/fs/gfs2/file.c >>> @@ -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)); >> >> Are these two changes still required? The function only seems to get >> called in the SETFLAGS ioctl path. >> >> Cheers, >> Andy >> > > Yes. This 3rd argument to do_gfs2_set_flags() is a field mask and is used > like this: > > new_flags = (flags & ~mask) | (reqflags & mask); > > Since the requested flags 'reqflags' from userspace (gfs2_jadd, for example) can't > set GFS2_DIF_SYSTEM, only way to preserve this flag's value across SETFLAGS ioctls > is to not touch it via the mask when it is ANDed with the existing flags 'flags'. > > Hope that makes sense. It does, thanks! Andy