lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Mon, 03 Jul 2023 06:46:33 -0400
From:   Jeff Layton <jlayton@...nel.org>
To:     Christian Brauner <brauner@...nel.org>
Cc:     Kara <jack@...e.cz>,
        "Tigran A. Aivazian" <aivazian.tigran@...il.com>,
        Al Viro <viro@...iv.linux.org.uk>,
        linux-kernel@...r.kernel.org,
        "damien.lemoal" <damien.lemoal@...nsource.wdc.com>,
        linux-fsdevel@...r.kernel.org
Subject: Re: [PATCH 15/79] bfs: switch to new ctime accessors

On Mon, 2023-07-03 at 12:12 +0200, Christian Brauner wrote:
> On Fri, Jun 23, 2023 at 02:33:26PM +0200, Christian Brauner wrote:
> > On Thu, Jun 22, 2023 at 04:57:47PM +0200, Jan Kara wrote:
> > > On Thu 22-06-23 08:51:58, Jeff Layton wrote:
> > > > On Thu, 2023-06-22 at 14:30 +0200, Jan Kara wrote:
> > > > > On Wed 21-06-23 12:57:19, Jeff Layton wrote:
> > > > > > On Wed, 2023-06-21 at 18:48 +0200, Jan Kara wrote:
> > > > > > > On Wed 21-06-23 10:45:28, Jeff Layton wrote:
> > > > > > > > In later patches, we're going to change how the ctime.tv_nsec field is
> > > > > > > > utilized. Switch to using accessor functions instead of raw accesses of
> > > > > > > > inode->i_ctime.
> > > > > > > > 
> > > > > > > > Signed-off-by: Jeff Layton <jlayton@...nel.org>
> > > > > > > 
> > > > > > > ...
> > > > > > > 
> > > > > > > > diff --git a/fs/bfs/inode.c b/fs/bfs/inode.c
> > > > > > > > index 1926bec2c850..c964316be32b 100644
> > > > > > > > --- a/fs/bfs/inode.c
> > > > > > > > +++ b/fs/bfs/inode.c
> > > > > > > > @@ -82,10 +82,10 @@ struct inode *bfs_iget(struct super_block *sb, unsigned long ino)
> > > > > > > >  	inode->i_blocks = BFS_FILEBLOCKS(di);
> > > > > > > >  	inode->i_atime.tv_sec =  le32_to_cpu(di->i_atime);
> > > > > > > >  	inode->i_mtime.tv_sec =  le32_to_cpu(di->i_mtime);
> > > > > > > > -	inode->i_ctime.tv_sec =  le32_to_cpu(di->i_ctime);
> > > > > > > > +	inode_ctime_set_sec(inode, le32_to_cpu(di->i_ctime));
> > > > > > > >  	inode->i_atime.tv_nsec = 0;
> > > > > > > >  	inode->i_mtime.tv_nsec = 0;
> > > > > > > > -	inode->i_ctime.tv_nsec = 0;
> > > > > > > > +	inode_ctime_set_nsec(inode, 0);
> > > > > > > 
> > > > > > > So I'm somewhat wondering here - in other filesystem you construct
> > > > > > > timespec64 and then use inode_ctime_set(). Here you use
> > > > > > > inode_ctime_set_sec() + inode_ctime_set_nsec(). What's the benefit? It
> > > > > > > seems these two functions are not used that much some maybe we could just
> > > > > > > live with just inode_ctime_set() and constructing timespec64 when needed?
> > > > > > > 
> > > > > > > 								Honza
> > > > > > 
> > > > > > The main advantage is that by using that, I didn't need to do quite so
> > > > > > much of this conversion by hand. My coccinelle skills are pretty
> > > > > > primitive. I went with whatever conversion was going to give minimal
> > > > > > changes, to the existing accesses for the most part.
> > > > > > 
> > > > > > We could certainly do it the way you suggest, it just means having to
> > > > > > re-touch a lot of this code by hand, or someone with better coccinelle
> > > > > > chops suggesting a way to declare a temporary variables in place.
> > > > > 
> > > > > Well, maybe temporary variables aren't that convenient but we could provide
> > > > > function setting ctime from sec & nsec value without having to declare
> > > > > temporary timespec64? Attached is a semantic patch that should deal with
> > > > > that - at least it seems to handle all the cases I've found.
> > > > > 
> > > > 
> > > > Ok, let me try respinning this with your cocci script and see how it
> > > > looks.
> > > > 
> > > > Damien also suggested in a reply to the zonefs patch a preference for
> > > > the naming style you have above. Should I also rename these like?
> > > > 
> > > >     inode_ctime_peek -> inode_get_ctime
> > > >     inode_ctime_set -> inode_set_ctime
> > > > 
> > > > This would be the time to change it if that's preferred.
> > > 
> > > I don't really care much so whatever you decide is better :)
> > 
> > I have a mild preference for inode_{get,set}_ctime().
> 
> Jeff, did you plan on sending a v2 with this renamed or do you want me
> to pick this up now?

I'm working on a new set that I'll send out in a few days. Sorry it has
taken a while, I spent quite a bit of time trying to improve my
coccinelle chops for this.

Thanks,
-- 
Jeff Layton <jlayton@...nel.org>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ