<feed xmlns='http://www.w3.org/2005/Atom'>
<title>kernel.git/fs/nfsd/trace.h, branch linux-6.7.y</title>
<subtitle>Hosts the 0x221E linux distro kernel.
</subtitle>
<id>https://git.0xinfinity.dev/distro/kernel.git/atom?h=linux-6.7.y</id>
<link rel='self' href='https://git.0xinfinity.dev/distro/kernel.git/atom?h=linux-6.7.y'/>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/'/>
<updated>2024-04-03T13:11:29Z</updated>
<entry>
<title>NFSD: Fix nfsd_clid_class use of __string_len() macro</title>
<updated>2024-04-03T13:11:29Z</updated>
<author>
<name>Steven Rostedt (Google)</name>
</author>
<published>2024-02-22T17:28:28Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=12c04627dfa1545c9fb86a63cc7c67fde84d111b'/>
<id>urn:sha1:12c04627dfa1545c9fb86a63cc7c67fde84d111b</id>
<content type='text'>
[ Upstream commit 9388a2aa453321bcf1ad2603959debea9e6ab6d4 ]

I'm working on restructuring the __string* macros so that it doesn't need
to recalculate the string twice. That is, it will save it off when
processing __string() and the __assign_str() will not need to do the work
again as it currently does.

Currently __string_len(item, src, len) doesn't actually use "src", but my
changes will require src to be correct as that is where the __assign_str()
will get its value from.

The event class nfsd_clid_class has:

  __string_len(name, name, clp-&gt;cl_name.len)

But the second "name" does not exist and causes my changes to fail to
build. That second parameter should be: clp-&gt;cl_name.data.

Link: https://lore.kernel.org/linux-trace-kernel/20240222122828.3d8d213c@gandalf.local.home

Cc: Neil Brown &lt;neilb@suse.de&gt;
Cc: Olga Kornievskaia &lt;kolga@netapp.com&gt;
Cc: Dai Ngo &lt;Dai.Ngo@oracle.com&gt;
Cc: Tom Talpey &lt;tom@talpey.com&gt;
Cc: stable@vger.kernel.org
Fixes: d27b74a8675ca ("NFSD: Use new __string_len C macros for nfsd_clid_class")
Acked-by: Chuck Lever &lt;chuck.lever@oracle.com&gt;
Acked-by: Jeff Layton &lt;jlayton@kernel.org&gt;
Signed-off-by: Steven Rostedt (Google) &lt;rostedt@goodmis.org&gt;
Signed-off-by: Sasha Levin &lt;sashal@kernel.org&gt;
</content>
</entry>
<entry>
<title>NFSD: add trace points to track server copy progress</title>
<updated>2023-10-16T16:44:00Z</updated>
<author>
<name>Dai Ngo</name>
</author>
<published>2023-08-31T19:35:47Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=5896a8705461052bfc2dcd7cf5909eaf3cecaa92'/>
<id>urn:sha1:5896a8705461052bfc2dcd7cf5909eaf3cecaa92</id>
<content type='text'>
Add trace points on destination server to track inter and intra
server copy operations.

Signed-off-by: Dai Ngo &lt;dai.ngo@oracle.com&gt;
Tested-by: Chen Hanxiao &lt;chenhx.fnst@fujitsu.com&gt;
Signed-off-by: Chuck Lever &lt;chuck.lever@oracle.com&gt;
</content>
</entry>
<entry>
<title>NFSD: Rename struct svc_cacherep</title>
<updated>2023-08-29T21:45:22Z</updated>
<author>
<name>Chuck Lever</name>
</author>
<published>2023-07-09T15:45:48Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=e7421ce71437ec8e4d69cc6bdf35b6853adc5050'/>
<id>urn:sha1:e7421ce71437ec8e4d69cc6bdf35b6853adc5050</id>
<content type='text'>
The svc_ prefix is identified with the SunRPC layer. Although the
duplicate reply cache caches RPC replies, it is only for the NFS
protocol. Rename the struct to better reflect its purpose.

Reviewed-by: Jeff Layton &lt;jlayton@kernel.org&gt;
Signed-off-by: Chuck Lever &lt;chuck.lever@oracle.com&gt;
</content>
</entry>
<entry>
<title>NFSD: Replace nfsd_prune_bucket()</title>
<updated>2023-08-29T21:45:22Z</updated>
<author>
<name>Chuck Lever</name>
</author>
<published>2023-07-09T15:45:29Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=a9507f6af1450ed26a4a36d979af518f5bb21e5d'/>
<id>urn:sha1:a9507f6af1450ed26a4a36d979af518f5bb21e5d</id>
<content type='text'>
Enable nfsd_prune_bucket() to drop the bucket lock while calling
kfree(). Use the same pattern that Jeff recently introduced in the
NFSD filecache.

A few percpu operations are moved outside the lock since they
temporarily disable local IRQs which is expensive and does not
need to be done while the lock is held.

Reviewed-by: Jeff Layton &lt;jlayton@kernel.org&gt;
Signed-off-by: Chuck Lever &lt;chuck.lever@oracle.com&gt;
</content>
</entry>
<entry>
<title>NFSD: Enable write delegation support</title>
<updated>2023-08-29T21:45:22Z</updated>
<author>
<name>Dai Ngo</name>
</author>
<published>2023-06-30T01:52:40Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=1d3dd1d56ce8322fb5b2a143ec9ff38c703bfeda'/>
<id>urn:sha1:1d3dd1d56ce8322fb5b2a143ec9ff38c703bfeda</id>
<content type='text'>
This patch grants write delegations for OPEN with NFS4_SHARE_ACCESS_WRITE
if there is no conflict with other OPENs.

Write delegation conflicts with another OPEN, REMOVE, RENAME and SETATTR
are handled the same as read delegation using notify_change,
try_break_deleg.

The NFSv4.0 protocol does not enable a server to determine that a
conflicting GETATTR originated from the client holding the
delegation versus coming from some other client. With NFSv4.1 and
later, the SEQUENCE operation that begins each COMPOUND contains a
client ID, so delegation recall can be safely squelched in this case.

With NFSv4.0, however, the server must recall or send a CB_GETATTR
(per RFC 7530 Section 16.7.5) even when the GETATTR originates from
the client holding that delegation.

An NFSv4.0 client can trigger a pathological situation if it always
sends a DELEGRETURN preceded by a conflicting GETATTR in the same
COMPOUND. COMPOUND execution will always stop at the GETATTR and the
DELEGRETURN will never get executed. The server eventually revokes
the delegation, which can result in loss of open or lock state.

Tracepoint added to track whether read or write delegation is granted.

Signed-off-by: Dai Ngo &lt;dai.ngo@oracle.com&gt;
Signed-off-by: Jeff Layton &lt;jlayton@kernel.org&gt;
Signed-off-by: Chuck Lever &lt;chuck.lever@oracle.com&gt;</content>
</entry>
<entry>
<title>NFSD: trace nfsctl operations</title>
<updated>2023-06-05T13:01:43Z</updated>
<author>
<name>Chuck Lever</name>
</author>
<published>2023-05-15T13:35:50Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=39d432fc76301cf0a0c454022117601994ca9397'/>
<id>urn:sha1:39d432fc76301cf0a0c454022117601994ca9397</id>
<content type='text'>
Add trace log eye-catchers that record the arguments used to
configure NFSD. This helps when troubleshooting the NFSD
administrative interfaces.

These tracepoints can capture NFSD start-up and shutdown times and
parameters, changes in lease time and thread count, and a request
to end the namespace's NFSv4 grace period, in addition to the set
of NFS versions that are enabled.

Reviewed-by: Jeff Layton &lt;jlayton@kernel.org&gt;
Signed-off-by: Chuck Lever &lt;chuck.lever@oracle.com&gt;
</content>
</entry>
<entry>
<title>NFSD: Remove open coding of string copy</title>
<updated>2023-05-15T12:03:04Z</updated>
<author>
<name>Azeem Shaikh</name>
</author>
<published>2023-05-15T02:40:44Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=21a3f3328972bdb774c62b301a715b5cebf03fa2'/>
<id>urn:sha1:21a3f3328972bdb774c62b301a715b5cebf03fa2</id>
<content type='text'>
Instead of open coding a __dynamic_array(), use the __string() and
__assign_str() helper macros that exist for this kind of use case.

Part of an effort to remove deprecated strlcpy() [1] completely from the
kernel[2].

[1] https://www.kernel.org/doc/html/latest/process/deprecated.html#strlcpy
[2] https://github.com/KSPP/linux/issues/89

Fixes: 3c92fba557c6 ("NFSD: Enhance the nfsd_cb_setup tracepoint")
Signed-off-by: Azeem Shaikh &lt;azeemshaikh38@gmail.com&gt;
Reviewed-by: Jeff Layton &lt;jlayton@kernel.org&gt;
Signed-off-by: Chuck Lever &lt;chuck.lever@oracle.com&gt;
</content>
</entry>
<entry>
<title>nfsd: don't fsync nfsd_files on last close</title>
<updated>2023-02-20T14:20:59Z</updated>
<author>
<name>Jeff Layton</name>
</author>
<published>2023-02-07T17:02:46Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=4c475eee02375ade6e864f1db16976ba0d96a0a2'/>
<id>urn:sha1:4c475eee02375ade6e864f1db16976ba0d96a0a2</id>
<content type='text'>
Most of the time, NFSv4 clients issue a COMMIT before the final CLOSE of
an open stateid, so with NFSv4, the fsync in the nfsd_file_free path is
usually a no-op and doesn't block.

We have a customer running knfsd over very slow storage (XFS over Ceph
RBD). They were using the "async" export option because performance was
more important than data integrity for this application. That export
option turns NFSv4 COMMIT calls into no-ops. Due to the fsync in this
codepath however, their final CLOSE calls would still stall (since a
CLOSE effectively became a COMMIT).

I think this fsync is not strictly necessary. We only use that result to
reset the write verifier. Instead of fsync'ing all of the data when we
free an nfsd_file, we can just check for writeback errors when one is
acquired and when it is freed.

If the client never comes back, then it'll never see the error anyway
and there is no point in resetting it. If an error occurs after the
nfsd_file is removed from the cache but before the inode is evicted,
then it will reset the write verifier on the next nfsd_file_acquire,
(since there will be an unseen error).

The only exception here is if something else opens and fsyncs the file
during that window. Given that local applications work with this
limitation today, I don't see that as an issue.

Link: https://bugzilla.redhat.com/show_bug.cgi?id=2166658
Fixes: ac3a2585f018 ("nfsd: rework refcounting in filecache")
Reported-and-tested-by: Pierguido Lambri &lt;plambri@redhat.com&gt;
Signed-off-by: Jeff Layton &lt;jlayton@kernel.org&gt;
Signed-off-by: Chuck Lever &lt;chuck.lever@oracle.com&gt;
</content>
</entry>
<entry>
<title>nfsd: fix handling of cached open files in nfsd4_open codepath</title>
<updated>2023-01-06T18:17:06Z</updated>
<author>
<name>Jeff Layton</name>
</author>
<published>2023-01-05T19:55:56Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=0b3a551fa58b4da941efeb209b3770868e2eddd7'/>
<id>urn:sha1:0b3a551fa58b4da941efeb209b3770868e2eddd7</id>
<content type='text'>
Commit fb70bf124b05 ("NFSD: Instantiate a struct file when creating a
regular NFSv4 file") added the ability to cache an open fd over a
compound. There are a couple of problems with the way this currently
works:

It's racy, as a newly-created nfsd_file can end up with its PENDING bit
cleared while the nf is hashed, and the nf_file pointer is still zeroed
out. Other tasks can find it in this state and they expect to see a
valid nf_file, and can oops if nf_file is NULL.

Also, there is no guarantee that we'll end up creating a new nfsd_file
if one is already in the hash. If an extant entry is in the hash with a
valid nf_file, nfs4_get_vfs_file will clobber its nf_file pointer with
the value of op_file and the old nf_file will leak.

Fix both issues by making a new nfsd_file_acquirei_opened variant that
takes an optional file pointer. If one is present when this is called,
we'll take a new reference to it instead of trying to open the file. If
the nfsd_file already has a valid nf_file, we'll just ignore the
optional file and pass the nfsd_file back as-is.

Also rework the tracepoints a bit to allow for an "opened" variant and
don't try to avoid counting acquisitions in the case where we already
have a cached open file.

Fixes: fb70bf124b05 ("NFSD: Instantiate a struct file when creating a regular NFSv4 file")
Cc: Trond Myklebust &lt;trondmy@hammerspace.com&gt;
Reported-by: Stanislav Saner &lt;ssaner@redhat.com&gt;
Reported-and-Tested-by: Ruben Vestergaard &lt;rubenv@drcmr.dk&gt;
Reported-and-Tested-by: Torkil Svensgaard &lt;torkil@drcmr.dk&gt;
Signed-off-by: Jeff Layton &lt;jlayton@kernel.org&gt;
Signed-off-by: Chuck Lever &lt;chuck.lever@oracle.com&gt;
</content>
</entry>
<entry>
<title>nfsd: rework refcounting in filecache</title>
<updated>2022-12-11T16:03:09Z</updated>
<author>
<name>Jeff Layton</name>
</author>
<published>2022-12-11T11:19:33Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=ac3a2585f018f10039b4a856dcb122da88c1c1c9'/>
<id>urn:sha1:ac3a2585f018f10039b4a856dcb122da88c1c1c9</id>
<content type='text'>
The filecache refcounting is a bit non-standard for something searchable
by RCU, in that we maintain a sentinel reference while it's hashed. This
in turn requires that we have to do things differently in the "put"
depending on whether its hashed, which we believe to have led to races.

There are other problems in here too. nfsd_file_close_inode_sync can end
up freeing an nfsd_file while there are still outstanding references to
it, and there are a number of subtle ToC/ToU races.

Rework the code so that the refcount is what drives the lifecycle. When
the refcount goes to zero, then unhash and rcu free the object. A task
searching for a nfsd_file is allowed to bump its refcount, but only if
it's not already 0. Ensure that we don't make any other changes to it
until a reference is held.

With this change, the LRU carries a reference. Take special care to deal
with it when removing an entry from the list, and ensure that we only
repurpose the nf_lru list_head when the refcount is 0 to ensure
exclusive access to it.

Signed-off-by: Jeff Layton &lt;jlayton@kernel.org&gt;
Signed-off-by: Chuck Lever &lt;chuck.lever@oracle.com&gt;
</content>
</entry>
</feed>
