<feed xmlns='http://www.w3.org/2005/Atom'>
<title>kernel.git/fs/nfs/dir.c, branch linux-3.18.y</title>
<subtitle>Hosts the 0x221E linux distro kernel.
</subtitle>
<id>https://git.0xinfinity.dev/distro/kernel.git/atom?h=linux-3.18.y</id>
<link rel='self' href='https://git.0xinfinity.dev/distro/kernel.git/atom?h=linux-3.18.y'/>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/'/>
<updated>2017-12-16T09:32:30Z</updated>
<entry>
<title>NFS: Fix a typo in nfs_rename()</title>
<updated>2017-12-16T09:32:30Z</updated>
<author>
<name>Trond Myklebust</name>
</author>
<published>2017-11-06T20:28:04Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=7e8df53aae065a07007ca35350b5b9119239656a'/>
<id>urn:sha1:7e8df53aae065a07007ca35350b5b9119239656a</id>
<content type='text'>
[ Upstream commit d803224c84be067754db7fa58a93f36f61566493 ]

On successful rename, the "old_dentry" is retained and is attached to
the "new_dir", so we need to call nfs_set_verifier() accordingly.

Signed-off-by: Trond Myklebust &lt;trond.myklebust@primarydata.com&gt;
Signed-off-by: Anna Schumaker &lt;Anna.Schumaker@Netapp.com&gt;
Signed-off-by: Sasha Levin &lt;alexander.levin@verizon.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>NFS: revalidate "." etc correctly on "open".</title>
<updated>2017-12-05T10:20:47Z</updated>
<author>
<name>NeilBrown</name>
</author>
<published>2017-08-25T07:34:41Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=9ea40d143494705b074688a4330b7085f06d3942'/>
<id>urn:sha1:9ea40d143494705b074688a4330b7085f06d3942</id>
<content type='text'>
commit b688741cb06695312f18b730653d6611e1bad28d upstream.

For correct close-to-open semantics, NFS must validate
the change attribute of a directory (or file) on open.

Since commit ecf3d1f1aa74 ("vfs: kill FS_REVAL_DOT by adding a
d_weak_revalidate dentry op"), open() of "." or a path ending ".." is
not revalidated reliably (except when that direct is a mount point).

Prior to that commit, "." was revalidated using nfs_lookup_revalidate()
which checks the LOOKUP_OPEN flag and forces revalidation if the flag is
set.
Since that commit, nfs_weak_revalidate() is used for NFSv3 (which
ignores the flags) and nothing is used for NFSv4.

This is fixed by using nfs_lookup_verify_inode() in
nfs_weak_revalidate().  This does the revalidation exactly when needed.
Also, add a definition of .d_weak_revalidate for NFSv4.

The incorrect behavior is easily demonstrated by running "echo *" in
some non-mountpoint NFS directory while watching network traffic.
Without this patch, "echo *" sometimes doesn't produce any traffic.
With the patch it always does.

Fixes: ecf3d1f1aa74 ("vfs: kill FS_REVAL_DOT by adding a d_weak_revalidate dentry op")
cc: stable@vger.kernel.org (3.9+)
Signed-off-by: NeilBrown &lt;neilb@suse.com&gt;
Signed-off-by: Anna Schumaker &lt;Anna.Schumaker@Netapp.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</content>
</entry>
<entry>
<title>NFS: only invalidate dentrys that are clearly invalid.</title>
<updated>2017-07-27T22:03:28Z</updated>
<author>
<name>NeilBrown</name>
</author>
<published>2017-07-05T02:22:20Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=c926ea02714ac450bc8c74b5aceb6fcd723349e3'/>
<id>urn:sha1:c926ea02714ac450bc8c74b5aceb6fcd723349e3</id>
<content type='text'>
commit cc89684c9a265828ce061037f1f79f4a68ccd3f7 upstream.

Since commit bafc9b754f75 ("vfs: More precise tests in d_invalidate")
in v3.18, a return of '0' from -&gt;d_revalidate() will cause the dentry
to be invalidated even if it has filesystems mounted on or it or on a
descendant.  The mounted filesystem is unmounted.

This means we need to be careful not to return 0 unless the directory
referred to truly is invalid.  So -ESTALE or -ENOENT should invalidate
the directory.  Other errors such a -EPERM or -ERESTARTSYS should be
returned from -&gt;d_revalidate() so they are propagated to the caller.

A particular problem can be demonstrated by:

1/ mount an NFS filesystem using NFSv3 on /mnt
2/ mount any other filesystem on /mnt/foo
3/ ls /mnt/foo
4/ turn off network, or otherwise make the server unable to respond
5/ ls /mnt/foo &amp;
6/ cat /proc/$!/stack # note that nfs_lookup_revalidate is in the call stack
7/ kill -9 $! # this results in -ERESTARTSYS being returned
8/ observe that /mnt/foo has been unmounted.

This patch changes nfs_lookup_revalidate() to only treat
  -ESTALE from nfs_lookup_verify_inode() and
  -ESTALE or -ENOENT from -&gt;lookup()
as indicating an invalid inode.  Other errors are returned.

Also nfs_check_inode_attributes() is changed to return -ESTALE rather
than -EIO.  This is consistent with the error returned in similar
circumstances from nfs_update_inode().

As this bug allows any user to unmount a filesystem mounted on an NFS
filesystem, this fix is suitable for stable kernels.

Fixes: bafc9b754f75 ("vfs: More precise tests in d_invalidate")
Signed-off-by: NeilBrown &lt;neilb@suse.com&gt;
Signed-off-by: Anna Schumaker &lt;Anna.Schumaker@Netapp.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</content>
</entry>
<entry>
<title>make nfs_atomic_open() call d_drop() on all -&gt;open_context() errors.</title>
<updated>2016-07-12T12:47:14Z</updated>
<author>
<name>Al Viro</name>
</author>
<published>2016-06-20T17:14:36Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=e9393f71fe6bb76aebb272dd8d8ce366c88d754c'/>
<id>urn:sha1:e9393f71fe6bb76aebb272dd8d8ce366c88d754c</id>
<content type='text'>
[ Upstream commit d20cb71dbf3487f24549ede1a8e2d67579b4632e ]

In "NFSv4: Move dentry instantiation into the NFSv4-specific atomic open code"
unconditional d_drop() after the -&gt;open_context() had been removed.  It had
been correct for success cases (there -&gt;open_context() itself had been doing
dcache manipulations), but not for error ones.  Only one of those (ENOENT)
got a compensatory d_drop() added in that commit, but in fact it should've
been done for all errors.  As it is, the case of O_CREAT non-exclusive open
on a hashed negative dentry racing with e.g. symlink creation from another
client ended up with -&gt;open_context() getting an error and proceeding to
call nfs_lookup().  On a hashed dentry, which would've instantly triggered
BUG_ON() in d_materialise_unique() (or, these days, its equivalent in
d_splice_alias()).

Cc: stable@vger.kernel.org # v3.10+
Tested-by: Oleg Drokin &lt;green@linuxhacker.ru&gt;
Signed-off-by: Al Viro &lt;viro@zeniv.linux.org.uk&gt;
Signed-off-by: Trond Myklebust &lt;trond.myklebust@primarydata.com&gt;
Signed-off-by: Anna Schumaker &lt;Anna.Schumaker@Netapp.com&gt;
Signed-off-by: Sasha Levin &lt;sasha.levin@oracle.com&gt;
</content>
</entry>
<entry>
<title>NFS: Don't invalidate a submounted dentry in nfs_prime_dcache()</title>
<updated>2015-03-24T01:02:51Z</updated>
<author>
<name>Trond Myklebust</name>
</author>
<published>2015-02-22T21:35:36Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=6394d0e510ce8d1de980fe2641f81ac84f3166cc'/>
<id>urn:sha1:6394d0e510ce8d1de980fe2641f81ac84f3166cc</id>
<content type='text'>
commit 6c441c254eea2354d686be7f5544bcd79fb6a61f upstream.

If we're traversing a directory which contains a submounted filesystem,
or one that has a referral, the NFS server that is processing the READDIR
request will often return information for the underlying (mounted-on)
directory. It may, or may not, also return filehandle information.

If this happens, and the lookup in nfs_prime_dcache() returns the
dentry for the submounted directory, the filehandle comparison will
fail, and we call d_invalidate(). Post-commit 8ed936b5671bf
("vfs: Lazily remove mounts on unlinked files and directories."), this
means the entire subtree is unmounted.

The following minimal patch addresses this problem by punting on
the invalidation if there is a submount.

Kudos to Neil Brown &lt;neilb@suse.de&gt; for having tracked down this
issue (see link).

Reported-by: Nix &lt;nix@esperi.org.uk&gt;
Link: http://lkml.kernel.org/r/87iofju9ht.fsf@spindle.srvr.nix
Signed-off-by: Trond Myklebust &lt;trond.myklebust@primarydata.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</content>
</entry>
<entry>
<title>NFSv4: Ensure nfs_atomic_open set the dentry verifier on ENOENT</title>
<updated>2014-11-05T01:53:49Z</updated>
<author>
<name>Trond Myklebust</name>
</author>
<published>2014-10-23T16:33:14Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=809fd143de8805970eec02c27c0bc2622a6ecbda'/>
<id>urn:sha1:809fd143de8805970eec02c27c0bc2622a6ecbda</id>
<content type='text'>
If the OPEN rpc call to the server fails with an ENOENT call, nfs_atomic_open
will create a negative dentry for that file, however it currently fails
to call nfs_set_verifier(), thus causing the dentry to be immediately
revalidated on the next call to nfs_lookup_revalidate() instead of following
the usual lookup caching rules.

Signed-off-by: Trond Myklebust &lt;trond.myklebust@primarydata.com&gt;
</content>
</entry>
<entry>
<title>vfs: Make d_invalidate return void</title>
<updated>2014-10-09T06:38:57Z</updated>
<author>
<name>Eric W. Biederman</name>
</author>
<published>2014-02-13T17:46:25Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=5542aa2fa7f6cddb03c4ac3135e390adffda98ca'/>
<id>urn:sha1:5542aa2fa7f6cddb03c4ac3135e390adffda98ca</id>
<content type='text'>
Now that d_invalidate can no longer fail, stop returning a useless
return code.  For the few callers that checked the return code update
remove the handling of d_invalidate failure.

Reviewed-by: Miklos Szeredi &lt;miklos@szeredi.hu&gt;
Signed-off-by: "Eric W. Biederman" &lt;ebiederm@xmission.com&gt;
Signed-off-by: Al Viro &lt;viro@zeniv.linux.org.uk&gt;
</content>
</entry>
<entry>
<title>vfs: Remove unnecessary calls of check_submounts_and_drop</title>
<updated>2014-10-09T06:38:56Z</updated>
<author>
<name>Eric W. Biederman</name>
</author>
<published>2014-02-13T17:34:30Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=9b053f3207e8887fed88162a339fdd4001abcdb2'/>
<id>urn:sha1:9b053f3207e8887fed88162a339fdd4001abcdb2</id>
<content type='text'>
Now that check_submounts_and_drop can not fail and is called from
d_invalidate there is no longer a need to call check_submounts_and_drom
from filesystem d_revalidate methods so remove it.

Reviewed-by: Miklos Szeredi &lt;miklos@szeredi.hu&gt;
Signed-off-by: "Eric W. Biederman" &lt;ebiederm@xmission.com&gt;
Signed-off-by: Al Viro &lt;viro@zeniv.linux.org.uk&gt;
</content>
</entry>
<entry>
<title>NFS: fix two problems in lookup_revalidate in RCU-walk</title>
<updated>2014-08-04T13:22:08Z</updated>
<author>
<name>NeilBrown</name>
</author>
<published>2014-08-04T06:24:00Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=50d77739fa1972030daf1c8902404551e49bf232'/>
<id>urn:sha1:50d77739fa1972030daf1c8902404551e49bf232</id>
<content type='text'>
1/ rcu_dereference isn't correct: that field isn't
   RCU protected.   It could potentially change at any time
   so ACCESS_ONCE might be justified.

   changes to -&gt;d_parent are protected by -&gt;d_seq.  However
   that isn't always checked after -&gt;d_revalidate is called,
   so it is safest to keep the double-check that -&gt;d_parent
   hasn't changed at the end of these functions.

2/ in nfs4_lookup_revalidate, "-&gt;d_parent" was forgotten.
   So 'parent' was not the parent of 'dentry'.
   This fails safe is the context is that dentry-&gt;d_inode is
   NULL, and the result of parent-&gt;d_inode being NULL is
   that ECHILD is returned, which is always safe.

Reported-by: kbuild test robot &lt;fengguang.wu@intel.com&gt;
Signed-off-by: NeilBrown &lt;neilb@suse.de&gt;
Signed-off-by: Trond Myklebust &lt;trond.myklebust@primarydata.com&gt;
</content>
</entry>
<entry>
<title>NFS: allow lockless access to access_cache</title>
<updated>2014-08-03T21:14:13Z</updated>
<author>
<name>NeilBrown</name>
</author>
<published>2014-07-14T01:28:20Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=f682a398b2e24ae0a775ddf37cced83b897198ee'/>
<id>urn:sha1:f682a398b2e24ae0a775ddf37cced83b897198ee</id>
<content type='text'>
The access cache is used during RCU-walk path lookups, so it is best
to avoid locking if possible as taking a lock kills concurrency.

The rbtree is not rcu-safe and cannot easily be made so.
Instead we simply check the last (i.e. most recent) entry on the LRU
list.  If this doesn't match, then we return -ECHILD and retry in
lock/refcount mode.

This requires freeing the nfs_access_entry struct with rcu, and
requires using rcu access primatives when adding entries to the lru, and
when examining the last entry.

Calling put_rpccred before kfree_rcu looks a bit odd, but as
put_rpccred already provides rcu protection, we know that the cred will
not actually be freed until the next grace period, so any concurrent
access will be safe.

This patch provides about 5% performance improvement on a stat-heavy
synthetic work load with 4 threads on a 2-core CPU.

Signed-off-by: NeilBrown &lt;neilb@suse.de&gt;
Signed-off-by: Trond Myklebust &lt;trond.myklebust@primarydata.com&gt;
</content>
</entry>
</feed>
