From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-qk1-f195.google.com ([209.85.222.195]:42354 "EHLO mail-qk1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728032AbeKJNKI (ORCPT ); Sat, 10 Nov 2018 08:10:08 -0500 Received: by mail-qk1-f195.google.com with SMTP id m5so5211247qka.9 for ; Fri, 09 Nov 2018 19:26:39 -0800 (PST) Date: Sat, 10 Nov 2018 00:26:34 -0300 From: Ernesto =?utf-8?Q?A=2E_Fern=C3=A1ndez?= To: Andrew Morton Cc: linux-fsdevel@vger.kernel.org Subject: Re: [PATCH] hfsplus: return file attributes on statx Message-ID: <20181110032634.kg4cgqee72wjzceo@eaf> References: <20181014163558.sxorxlzjqccq2lpw@eaf> <20181109142630.33f18bf16f7d4d1684c1795d@linux-foundation.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20181109142630.33f18bf16f7d4d1684c1795d@linux-foundation.org> Sender: linux-fsdevel-owner@vger.kernel.org List-ID: On Fri, Nov 09, 2018 at 02:26:30PM -0800, Andrew Morton wrote: > On Sun, 14 Oct 2018 13:35:58 -0300 Ernesto A. Fernández wrote: > > > The immutable, append-only and no-dump attributes can only be retrieved > > with an ioctl; implement the ->getattr() method to return them on statx. > > Do not return the inode birthtime yet, because the issue of how best to > > handle the post-2038 timestamps is still under discussion. > > > > This patch is needed to pass xfstests generic/424. > > It's been a while since I looked into such things... > > > --- a/fs/hfsplus/inode.c > > +++ b/fs/hfsplus/inode.c > > @@ -270,6 +270,26 @@ static int hfsplus_setattr(struct dentry *dentry, struct iattr *attr) > > return 0; > > } > > > > +int hfsplus_getattr(const struct path *path, struct kstat *stat, > > + u32 request_mask, unsigned int query_flags) > > +{ > > + struct inode *inode = d_inode(path->dentry); > > + struct hfsplus_inode_info *hip = HFSPLUS_I(inode); > > + > > + if (inode->i_flags & S_APPEND) > > + stat->attributes |= STATX_ATTR_APPEND; > > + if (inode->i_flags & S_IMMUTABLE) > > + stat->attributes |= STATX_ATTR_IMMUTABLE; > > ext4_getattr() inspects the underlying ext4_inode's flags to determine > the above. But here hfs is looking at the vfs-level inode. Which is > correct, which is best, do we know why they differ, etc? ext4 is not reading the flags from the ext4_inode directly, it reads them from ext4_inode_info. hfsplus_inode_info doesn't have that information anymore, since 722c55d13e72 ("hfsplus: remove superflous rootflags field in hfsplus_inode_info"). My intention here was to follow what the FS_IOC_GETFLAGS ioctl is doing, so I just copied the checks from hfsplus_ioctl_getflags() at ioctl.c. > > > + if (hip->userflags & HFSPLUS_FLG_NODUMP) > > + stat->attributes |= STATX_ATTR_NODUMP; > > + > > + stat->attributes_mask |= STATX_ATTR_APPEND | STATX_ATTR_IMMUTABLE | > > + STATX_ATTR_NODUMP; > > + > > + generic_fillattr(inode, stat); > > + return 0; > > +} > >