<feed xmlns='http://www.w3.org/2005/Atom'>
<title>kernel.git/fs/nfs/dir.c, branch linux-5.16.y</title>
<subtitle>Hosts the 0x221E linux distro kernel.
</subtitle>
<id>https://git.0xinfinity.dev/distro/kernel.git/atom?h=linux-5.16.y</id>
<link rel='self' href='https://git.0xinfinity.dev/distro/kernel.git/atom?h=linux-5.16.y'/>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/'/>
<updated>2022-04-13T18:03:12Z</updated>
<entry>
<title>NFSv4: fix open failure with O_ACCMODE flag</title>
<updated>2022-04-13T18:03:12Z</updated>
<author>
<name>ChenXiaoSong</name>
</author>
<published>2022-03-29T11:32:08Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=33bc9de81538600ca3328a41ac33c5d7e755558c'/>
<id>urn:sha1:33bc9de81538600ca3328a41ac33c5d7e755558c</id>
<content type='text'>
[ Upstream commit b243874f6f9568b2daf1a00e9222cacdc15e159c ]

open() with O_ACCMODE|O_DIRECT flags secondly will fail.

Reproducer:
  1. mount -t nfs -o vers=4.2 $server_ip:/ /mnt/
  2. fd = open("/mnt/file", O_ACCMODE|O_DIRECT|O_CREAT)
  3. close(fd)
  4. fd = open("/mnt/file", O_ACCMODE|O_DIRECT)

Server nfsd4_decode_share_access() will fail with error nfserr_bad_xdr when
client use incorrect share access mode of 0.

Fix this by using NFS4_SHARE_ACCESS_BOTH share access mode in client,
just like firstly opening.

Fixes: ce4ef7c0a8a05 ("NFS: Split out NFS v4 file operations")
Signed-off-by: ChenXiaoSong &lt;chenxiaosong2@huawei.com&gt;
Signed-off-by: Trond Myklebust &lt;trond.myklebust@hammerspace.com&gt;
Signed-off-by: Sasha Levin &lt;sashal@kernel.org&gt;
</content>
</entry>
<entry>
<title>NFS: LOOKUP_DIRECTORY is also ok with symlinks</title>
<updated>2022-02-23T11:06:01Z</updated>
<author>
<name>Trond Myklebust</name>
</author>
<published>2022-02-08T18:38:23Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=aab7d08fd5126be9bdc9e9fa5b56cf2385872a5e'/>
<id>urn:sha1:aab7d08fd5126be9bdc9e9fa5b56cf2385872a5e</id>
<content type='text'>
commit e0caaf75d443e02e55e146fd75fe2efc8aed5540 upstream.

Commit ac795161c936 (NFSv4: Handle case where the lookup of a directory
fails) [1], part of Linux since 5.17-rc2, introduced a regression, where
a symbolic link on an NFS mount to a directory on another NFS does not
resolve(?) the first time it is accessed:

Reported-by: Paul Menzel &lt;pmenzel@molgen.mpg.de&gt;
Fixes: ac795161c936 ("NFSv4: Handle case where the lookup of a directory fails")
Signed-off-by: Trond Myklebust &lt;trond.myklebust@hammerspace.com&gt;
Tested-by: Donald Buczek &lt;buczek@molgen.mpg.de&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: Avoid duplicate uncached readdir calls on eof</title>
<updated>2022-02-16T11:58:30Z</updated>
<author>
<name>Trond Myklebust</name>
</author>
<published>2022-01-19T03:10:52Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=e3a141f26734694812292b1ec949006e84b41ead'/>
<id>urn:sha1:e3a141f26734694812292b1ec949006e84b41ead</id>
<content type='text'>
[ Upstream commit e1d2699b96793d19388e302fa095e0da2c145701 ]

If we've reached the end of the directory, then cache that information
in the context so that we don't need to do an uncached readdir in order
to rediscover that fact.

Fixes: 794092c57f89 ("NFS: Do uncached readdir when we're seeking a cookie in an empty page cache")
Signed-off-by: Trond Myklebust &lt;trond.myklebust@hammerspace.com&gt;
Signed-off-by: Anna Schumaker &lt;Anna.Schumaker@Netapp.com&gt;
Signed-off-by: Sasha Levin &lt;sashal@kernel.org&gt;
</content>
</entry>
<entry>
<title>NFS: Don't skip directory entries when doing uncached readdir</title>
<updated>2022-02-16T11:58:30Z</updated>
<author>
<name>trondmy@kernel.org</name>
</author>
<published>2022-01-19T00:52:16Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=77bfe650e59d77ae2ec096a466f68a531ce09fde'/>
<id>urn:sha1:77bfe650e59d77ae2ec096a466f68a531ce09fde</id>
<content type='text'>
[ Upstream commit ce292d8faf41f62e0fb0c78476c6fce5d629235a ]

Ensure that we initialise desc-&gt;cache_entry_index correctly in
uncached_readdir().

Fixes: d1bacf9eb2fd ("NFS: add readdir cache array")
Signed-off-by: Trond Myklebust &lt;trond.myklebust@hammerspace.com&gt;
Signed-off-by: Anna Schumaker &lt;Anna.Schumaker@Netapp.com&gt;
Signed-off-by: Sasha Levin &lt;sashal@kernel.org&gt;
</content>
</entry>
<entry>
<title>NFS: Don't overfill uncached readdir pages</title>
<updated>2022-02-16T11:58:30Z</updated>
<author>
<name>trondmy@kernel.org</name>
</author>
<published>2022-01-19T00:25:42Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=98512f35a20028f4793e1b97db96dc75e2ef1cdb'/>
<id>urn:sha1:98512f35a20028f4793e1b97db96dc75e2ef1cdb</id>
<content type='text'>
[ Upstream commit d9c4e39c1f8f8a8ebaccf00b8f22c14364b2d27e ]

If we're doing an uncached read of the directory, then we ideally want
to read only the exact set of entries that will fit in the buffer
supplied by the getdents() system call. So unlike the case where we're
reading into the page cache, let's send only one READDIR call, before
trying to fill up the buffer.

Fixes: 35df59d3ef69 ("NFS: Reduce number of RPC calls when doing uncached readdir")
Signed-off-by: Trond Myklebust &lt;trond.myklebust@hammerspace.com&gt;
Signed-off-by: Anna Schumaker &lt;Anna.Schumaker@Netapp.com&gt;
Signed-off-by: Sasha Levin &lt;sashal@kernel.org&gt;
</content>
</entry>
<entry>
<title>NFS: change nfs_access_get_cached to only report the mask</title>
<updated>2022-02-16T11:58:09Z</updated>
<author>
<name>NeilBrown</name>
</author>
<published>2021-09-27T23:47:57Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=4d8a71c9ed50468a67e9123a854305078821bd84'/>
<id>urn:sha1:4d8a71c9ed50468a67e9123a854305078821bd84</id>
<content type='text'>
[ Upstream commit b5e7b59c3480f355910f9d2c6ece5857922a5e54 ]

Currently the nfs_access_get_cached family of functions report a
'struct nfs_access_entry' as the result, with both .mask and .cred set.
However the .cred is never used.  This is probably good and there is no
guarantee that it won't be freed before use.

Change to only report the 'mask' - as this is all that is used or needed.

Signed-off-by: NeilBrown &lt;neilb@suse.de&gt;
Signed-off-by: Anna Schumaker &lt;Anna.Schumaker@Netapp.com&gt;
Signed-off-by: Sasha Levin &lt;sashal@kernel.org&gt;
</content>
</entry>
<entry>
<title>NFS: Ensure the server has an up to date ctime before renaming</title>
<updated>2022-02-01T16:29:12Z</updated>
<author>
<name>Trond Myklebust</name>
</author>
<published>2021-12-15T21:38:16Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=e2d4111a2c0be7d6a3493d143a68622b4947a4a6'/>
<id>urn:sha1:e2d4111a2c0be7d6a3493d143a68622b4947a4a6</id>
<content type='text'>
[ Upstream commit 6ff9d99bb88faebf134ca668842349d9718e5464 ]

Renaming a file is required by POSIX to update the file ctime, so
ensure that the file data is synced to disk so that we don't clobber the
updated ctime by writing back after creating the hard link.

Fixes: f2c2c552f119 ("NFS: Move delegation recall into the NFSv4 callback for rename_setup()")
Signed-off-by: Trond Myklebust &lt;trond.myklebust@hammerspace.com&gt;
Signed-off-by: Anna Schumaker &lt;Anna.Schumaker@Netapp.com&gt;
Signed-off-by: Sasha Levin &lt;sashal@kernel.org&gt;
</content>
</entry>
<entry>
<title>NFS: Ensure the server has an up to date ctime before hardlinking</title>
<updated>2022-02-01T16:29:12Z</updated>
<author>
<name>Trond Myklebust</name>
</author>
<published>2021-12-15T21:38:15Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=498286ab591ffee4bc788acd5b94dfb23050d0eb'/>
<id>urn:sha1:498286ab591ffee4bc788acd5b94dfb23050d0eb</id>
<content type='text'>
[ Upstream commit 204975036b34f55237bc44c8a302a88468ef21b5 ]

Creating a hard link is required by POSIX to update the file ctime, so
ensure that the file data is synced to disk so that we don't clobber the
updated ctime by writing back after creating the hard link.

Fixes: 9f7682728728 ("NFS: Move the delegation return down into nfs4_proc_link()")
Signed-off-by: Trond Myklebust &lt;trond.myklebust@hammerspace.com&gt;
Signed-off-by: Anna Schumaker &lt;Anna.Schumaker@Netapp.com&gt;
Signed-off-by: Sasha Levin &lt;sashal@kernel.org&gt;
</content>
</entry>
<entry>
<title>NFSv4: nfs_atomic_open() can race when looking up a non-regular file</title>
<updated>2022-02-01T16:29:11Z</updated>
<author>
<name>Trond Myklebust</name>
</author>
<published>2022-01-06T23:24:03Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=36a07159e335cd900946293bd5acb7b79f74235f'/>
<id>urn:sha1:36a07159e335cd900946293bd5acb7b79f74235f</id>
<content type='text'>
commit 1751fc1db36f6f411709e143d5393f92d12137a9 upstream.

If the file type changes back to being a regular file on the server
between the failed OPEN and our LOOKUP, then we need to re-run the OPEN.

Fixes: 0dd2b474d0b6 ("nfs: implement i_op-&gt;atomic_open()")
Signed-off-by: Trond Myklebust &lt;trond.myklebust@hammerspace.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>NFSv4: Handle case where the lookup of a directory fails</title>
<updated>2022-02-01T16:29:11Z</updated>
<author>
<name>Trond Myklebust</name>
</author>
<published>2022-01-06T23:24:02Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=f0583af88e7dd413229ea5e670a0db36fdf34ba2'/>
<id>urn:sha1:f0583af88e7dd413229ea5e670a0db36fdf34ba2</id>
<content type='text'>
commit ac795161c93699d600db16c1a8cc23a65a1eceaf upstream.

If the application sets the O_DIRECTORY flag, and tries to open a
regular file, nfs_atomic_open() will punt to doing a regular lookup.
If the server then returns a regular file, we will happily return a
file descriptor with uninitialised open state.

The fix is to return the expected ENOTDIR error in these cases.

Reported-by: Lyu Tao &lt;tao.lyu@epfl.ch&gt;
Fixes: 0dd2b474d0b6 ("nfs: implement i_op-&gt;atomic_open()")
Signed-off-by: Trond Myklebust &lt;trond.myklebust@hammerspace.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>
</feed>
