linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jan Kara <jack@suse.cz>
To: Kim Jaegeuk <jaegeuk.kim@gmail.com>
Cc: Jan Kara <jack@suse.cz>,
	Linus Torvalds <torvalds@linux-foundation.org>,
	Al Viro <viro@zeniv.linux.org.uk>, Christoph Hellwig <hch@lst.de>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	linux-fsdevel <linux-fsdevel@vger.kernel.org>,
	Jaegeuk Kim <jaegeuk.kim@samsung.com>
Subject: Re: [git pull] vfs pile 1
Date: Thu, 30 Jan 2014 16:26:36 +0100	[thread overview]
Message-ID: <20140130152636.GB12687@quack.suse.cz> (raw)
In-Reply-To: <CAOtxgyd_T8eXpQ89KhMCLRhy6ebO55dXscVikhuX2a9HCdGTQA@mail.gmail.com>

On Thu 30-01-14 11:02:49, Kim Jaegeuk wrote:
> 2014-01-29 Jan Kara <jack@suse.cz>:
> > On Tue 28-01-14 19:26:08, Linus Torvalds wrote:
> >> On Mon, Jan 27, 2014 at 6:25 AM, Al Viro <viro@zeniv.linux.org.uk> wrote:
> >> >         Assorted stuff; the biggest pile here is Christoph's ACL series.
> >> > Plus assorted cleanups and fixes all over the place...  There will be
> >> > another pile later this week.
> >>
> >> The posix_acl_chmod() code looks wrong.
> >>
> >> Not that it looked right before either, but whatever. The code
> >> basically looks like some variation of this in most setattr()
> >> implementations:
> >>
> >>         if (ia_valid & ATTR_MODE)
> >>                 rc = posix_acl_chmod(inode, inode->i_mode);
> >>
> >> but the mode we're changing to (and what ATTR_MODE guards) is actually
> >> attr->ia_mode, not inode->i_mode.
> >   Yes, but posix_acl_chmod() is called after setattr_copy() was done so
> > inode->i_mode should be the same as attr->ia_mode. Whether i_mode or
> > ia_mode is mode logical depends on whether you view posix_acl_chmod() as
> > "sync current i_mode into acls" or "reflect this i_mode change in acls".
> > I agree the function name suggests more the latter semantics.
> >
> >> And quite frankly, passing in inode->i_mode looks stupid, since we're
> >> already passing in the inode pointer, so that's just redundant and
> >> pointless information.
> >   Yes, it looks stupid. We could almost drop that argument, except that f2fs
> > tries to play some tricks with i_mode and stores i_mode in a different
> > place when acls are enabled. Huh? Jaegeuk, can you explain why are you
> > doing that?
> 
> As described to Christoph before, the reason is for acl consistency
> between on-disk xattr->mode and on-disk inode->mode.
> 
> Previously, there are three i_modes managed by:
>                        inode->mode   on-disk xattr->mode  on-disk->i_mode
> f2fs_setattr            [x]                       y                       y
> [update_inode]       x                        y                      [x]
> [checkpoint]            x                       [y]                      x
> __f2fs_setxattr        x                       [x]                      x
> 
> In this flow, f2fs is able to break the consistency between on-disk
> xattr->mode and on-disk->i_mode after checkpoint followed by
> sudden-power-off.
> 
> So, fi->i_mode was introduced to address the problem.
> The new f2fs_setattr triggers:
>                 inode->mode   fi->i_mode  on-disk xattr->mode  on-disk->i_mode
> f2fs_setattr             y                [x]                     y
>                       y
> [update_inode]       y                 x                      y
>                   y
> [checkpoint]            y                 x                      y
>                      y
> __f2fs_setxattr       [x]                x                     [x]
>                    [x]
> 
> Finally, __f2fs_setxattr synchronizes inode->mode, on-disk xattr->mode,
> and on-disk inode->i_mode all together.
> 
> Am I missing something?
  OK, I see. Thanks for explanation.

								Honza
-- 
Jan Kara <jack@suse.cz>
SUSE Labs, CR

  reply	other threads:[~2014-01-30 15:26 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-01-27 14:25 [git pull] vfs pile 1 Al Viro
2014-01-27 23:05 ` Stephen Rothwell
2014-01-29  3:26 ` Linus Torvalds
2014-01-29 13:37   ` Jan Kara
2014-01-30  2:02     ` Kim Jaegeuk
2014-01-30 15:26       ` Jan Kara [this message]
2014-01-30 13:07   ` Christoph Hellwig
  -- strict thread matches above, loose matches on Subject: below --
2018-06-04  0:59 [git pull] vfs, " Al Viro
2016-12-16 13:30 [git pull] vfs " Al Viro
2015-09-06  2:55 Al Viro
2015-06-22  6:47 Al Viro
2013-02-27  3:24 Al Viro
2012-03-21  3:31 Al Viro
2012-01-05  2:23 Al Viro
2012-01-08 23:04 ` Linus Torvalds
2012-01-08 23:50   ` Al Viro
2012-01-08 23:53     ` Al Viro
2012-01-09  0:11       ` Linus Torvalds
2012-01-09  0:25         ` Al Viro
2012-01-09  0:39           ` Linus Torvalds
2012-01-09  2:12             ` Al Viro
2012-01-09 15:11     ` Ted Ts'o
2012-01-11 11:58   ` Christoph Hellwig
2012-01-11 12:36     ` Miklos Szeredi
2012-01-11 12:40       ` Christoph Hellwig
2012-01-11 13:12         ` Miklos Szeredi
2012-01-11 15:23           ` Ted Ts'o
2012-01-11 16:19             ` Al Viro
2012-01-12 11:41               ` Miklos Szeredi
2011-05-26 11:53 Al Viro
2011-01-13  5:35 Al Viro
2011-01-13  6:25 ` Stephen Rothwell
2011-01-13  8:55   ` Christoph Hellwig

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20140130152636.GB12687@quack.suse.cz \
    --to=jack@suse.cz \
    --cc=hch@lst.de \
    --cc=jaegeuk.kim@gmail.com \
    --cc=jaegeuk.kim@samsung.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=torvalds@linux-foundation.org \
    --cc=viro@zeniv.linux.org.uk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).