Re: [PATCH v3 2/4] ovl: relax WARN_ON() real inode attributes mismatch

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, May 16, 2018 at 1:06 PM, Amir Goldstein <amir73il@xxxxxxxxx> wrote:
> On Wed, May 16, 2018 at 1:29 PM, Miklos Szeredi <miklos@xxxxxxxxxx> wrote:
>> On Tue, May 15, 2018 at 12:26 PM, Amir Goldstein <amir73il@xxxxxxxxx> wrote:
>>> Overlayfs should cope with online changes to underlying layer
>>> without crashing the kernel, which is what xfstest overlay/019
>>> checks.
>>>
>>> This test may sometimes trigger WARN_ON() in ovl_create_or_link()
>>> when linking an overlay inode that has been changed on underlying
>>> layer.
>>>
>>> Replace those WARN_ON() with pr_warn_ratelimited() to prevent
>>> test from failing and because this is more appropriate to the
>>> use case.
>>>
>>> Signed-off-by: Amir Goldstein <amir73il@xxxxxxxxx>
>>> ---
>>>  fs/overlayfs/dir.c | 14 +++++++++++---
>>>  1 file changed, 11 insertions(+), 3 deletions(-)
>>>
>>> diff --git a/fs/overlayfs/dir.c b/fs/overlayfs/dir.c
>>> index 62e6733b755c..25b339278684 100644
>>> --- a/fs/overlayfs/dir.c
>>> +++ b/fs/overlayfs/dir.c
>>> @@ -525,9 +525,17 @@ static int ovl_create_or_link(struct dentry *dentry, struct inode *inode,
>>>         if (!err) {
>>>                 struct inode *realinode = d_inode(ovl_dentry_upper(dentry));
>>>
>>> -               WARN_ON(inode->i_mode != realinode->i_mode);
>>> -               WARN_ON(!uid_eq(inode->i_uid, realinode->i_uid));
>>> -               WARN_ON(!gid_eq(inode->i_gid, realinode->i_gid));
>>> +               if (inode->i_mode != realinode->i_mode ||
>>> +                   !uid_eq(inode->i_uid, realinode->i_uid) ||
>>> +                   !gid_eq(inode->i_gid, realinode->i_gid)) {
>>> +                       pr_warn_ratelimited("overlayfs: real inode attributes mismatch (%pd2, %o.%u.%u != %o.%u.%u).\n",
>>> +                               dentry, inode->i_mode,
>>> +                               from_kuid(&init_user_ns, inode->i_uid),
>>> +                               from_kgid(&init_user_ns, inode->i_gid),
>>> +                               realinode->i_mode,
>>> +                               from_kuid(&init_user_ns, realinode->i_uid),
>>> +                               from_kgid(&init_user_ns, realinode->i_gid));
>>> +               }
>>
>> How about just dropping the warnings altogether.  They didn't discover
>> an issue with the code, just something normal, so IMO we should just
>> get rid of them.
>>
>
> OK. On that subject, do you want to leave the 'debug' argument
> to ovl_do_XXX? I started peeling it off slowly from the new helpers,
> but maybe we should just yank it completely from the ovl_do_XXX
> helpers? pr_debug can be disabled dynamically anyway. right?

Right.  The original idea was to not debug upper operations that are
just verbatim copies of the overlay operation, but I guess it doesn't
really hurt to debug unconditionally.

Thanks,
Miklos
--
To unsubscribe from this list: send the line "unsubscribe linux-unionfs" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux Filesystems Devel]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux