All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Stefan (metze) Metzmacher" <metze-eUNUBHrolfbYtjvyW6yDsg@public.gmane.org>
To: David McBride <dwm37-KWPb1pKIrIJaa/9Udqfwiw@public.gmane.org>
Cc: linux-cifs-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	Steve French <smfrench-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>,
	Jeff Layton <jlayton-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>,
	Sachin Prabhu <sprabhu-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>,
	stable-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: Re: [BUG] Regression in mfsymlink handling introduced by "cifs: only set ops for inodes in I_NEW state"
Date: Tue, 06 Aug 2013 16:30:52 +0200	[thread overview]
Message-ID: <5201089C.1010403@samba.org> (raw)
In-Reply-To: <51F92F0B.7030504-KWPb1pKIrIJaa/9Udqfwiw@public.gmane.org>

[-- Attachment #1: Type: text/plain, Size: 1941 bytes --]

Hi David,

> The following commit included in 3.10, and copied to some table-series
> kernels:
> 
>  commit: c2b93e0699723700f886ce17bb65ffd771195a6d
>  cifs: only set ops for inodes in I_NEW state
> 
> ... causes a regression in mfsymlink handling under some circumstances.
> 
> Specifically, this patch modified cifs_fattr_to_inode() to only invoke
> cifs_set_ops() if that inode still had the I_NEW flag set --- preventing
> an inode's ops-set from from being changed after it had been
> initialized, preventing an oops if another thread of execution was
> already chasing that pointer.
> 
> However, mfsymlinks are also affected by this commit.  In the cold-cache
> case, a user invoking stat() on an mfsymlink will still see the correct
> results.  But, if the dentry cache is instead populated via
> cifs_readdir/filldir, then inode property population operates in a two
> stage mode:
> 
>  - First, the inode is initialized as a regular file, with the
>    CIFS_FATTR_NEED_REVAL flag set.
> 
>  - Later, when the file is stat()'d, then correct operation depends on
>    the (re)validation steps from being able to update the inode's
>    properties --- including the set of file operations permitted.
> 
> (A comment explains:  "trying to get the type and mode can be slow, so
>  just call those regular files for now, and mark for reval")
> 
> With the above commit, this second revalidation step never updates the
> operations field, resulting in symlinks not having the readlink(), etc.
> functions correctly hooked up.

> A naïve fix-up is to modify the conditional to also permit (re)setting
> ops on S_IFLNK-mode files; however, I suspect a correct fix lies elsewhere?

I guess 'if (inode->i_state & I_NEW)' should be changed to
'if ((inode->i_state & I_NEW) || (fattr->cf_flags & CIFS_FATTR_NEED_REVAL))'

Would that solve the problem?

Jeff/Steve, any comment on this?

metze


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 261 bytes --]

  parent reply	other threads:[~2013-08-06 14:30 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-07-31 15:36 [BUG] Regression in mfsymlink handling introduced by "cifs: only set ops for inodes in I_NEW state" David McBride
     [not found] ` <51F92F0B.7030504-KWPb1pKIrIJaa/9Udqfwiw@public.gmane.org>
2013-08-06 14:30   ` Stefan (metze) Metzmacher [this message]
     [not found]     ` <5201089C.1010403-eUNUBHrolfbYtjvyW6yDsg@public.gmane.org>
2013-08-06 14:56       ` Jeff Layton
     [not found]         ` <20130806105623.322d32a6-9yPaYZwiELC+kQycOl6kW4xkIHaj4LzF@public.gmane.org>
2013-08-07 12:09           ` Jeff Layton
2013-08-07 13:04   ` [PATCH] cifs: don't instantiate new dentries in readdir for inodes that need to be revalidated immediately Jeff Layton
     [not found]     ` <1375880647-22512-1-git-send-email-jlayton-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2013-08-07 13:06       ` Jeff Layton
     [not found]         ` <20130807090616.6ba44d6c-9yPaYZwiELC+kQycOl6kW4xkIHaj4LzF@public.gmane.org>
2013-08-07 13:42           ` David McBride
     [not found]             ` <52024EC3.2070504-KWPb1pKIrIJaa/9Udqfwiw@public.gmane.org>
2013-08-08 14:05               ` Marcus Moeller
     [not found]                 ` <5203A5B8.80600-OI3hZJvNYWs@public.gmane.org>
2013-08-08 14:22                   ` Jeff Layton
     [not found]                     ` <20130808102236.44424bf3-9yPaYZwiELC+kQycOl6kW4xkIHaj4LzF@public.gmane.org>
2013-08-08 15:33                       ` Steve French
     [not found]                         ` <CAH2r5muc+5xpabeQYNJq5Vb2_2nAMof2EUUFbkMpoBsUX7MC+g-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2013-08-12  6:07                           ` Marcus Moeller

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=5201089C.1010403@samba.org \
    --to=metze-eunubhrolfbytjvyw6ydsg@public.gmane.org \
    --cc=dwm37-KWPb1pKIrIJaa/9Udqfwiw@public.gmane.org \
    --cc=jlayton-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org \
    --cc=linux-cifs-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=smfrench-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
    --cc=sprabhu-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org \
    --cc=stable-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.