All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v3 0/2] NFSD: Fix problem with nfsd4_scsi_fence_client
@ 2025-11-05 20:45 Dai Ngo
  2025-11-05 20:45 ` [PATCH v3 1/2] NFSD: use correct reservation type in nfsd4_scsi_fence_client Dai Ngo
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Dai Ngo @ 2025-11-05 20:45 UTC (permalink / raw)
  To: chuck.lever, jlayton, neilb, okorniev, tom, hch; +Cc: linux-nfs

This patchset includes the following:

. Fix problem with nfsd4_scsi_fence_client using the wrong reservation type.
. Add trace point to track SCSI preempt operation.

v2:
. drop patch that skips fencing on NFS4ERR_RETRY_UNCACHED_REP
. add namespace number in output of fencing trace point

v3:
. reword title of patch 1/2

 fs/nfsd/blocklayout.c |  8 ++++++--
 fs/nfsd/trace.h       | 38 ++++++++++++++++++++++++++++++++++++++
 2 files changed, 44 insertions(+), 2 deletions(-)

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH v3 1/2] NFSD: use correct reservation type in nfsd4_scsi_fence_client
  2025-11-05 20:45 [PATCH v3 0/2] NFSD: Fix problem with nfsd4_scsi_fence_client Dai Ngo
@ 2025-11-05 20:45 ` Dai Ngo
  2025-11-06 11:43   ` Christoph Hellwig
  2025-11-05 20:45 ` [PATCH v3 2/2] NFSD: Add trace point for SCSI fencing operation Dai Ngo
  2025-11-06 16:14 ` [PATCH v3 0/2] NFSD: Fix problem with nfsd4_scsi_fence_client Chuck Lever
  2 siblings, 1 reply; 5+ messages in thread
From: Dai Ngo @ 2025-11-05 20:45 UTC (permalink / raw)
  To: chuck.lever, jlayton, neilb, okorniev, tom, hch; +Cc: linux-nfs

The reservation type argument for the pr_preempt call should match the
one used in nfsd4_block_get_device_info_scsi.

Fixes: f99d4fbdae67 ("nfsd: add SCSI layout support")
Signed-off-by: Dai Ngo <dai.ngo@oracle.com>
---
 fs/nfsd/blocklayout.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/fs/nfsd/blocklayout.c b/fs/nfsd/blocklayout.c
index fde5539cf6a6..815c6e0cde5e 100644
--- a/fs/nfsd/blocklayout.c
+++ b/fs/nfsd/blocklayout.c
@@ -342,7 +342,8 @@ nfsd4_scsi_fence_client(struct nfs4_layout_stateid *ls, struct nfsd_file *file)
 	struct block_device *bdev = file->nf_file->f_path.mnt->mnt_sb->s_bdev;
 
 	bdev->bd_disk->fops->pr_ops->pr_preempt(bdev, NFSD_MDS_PR_KEY,
-			nfsd4_scsi_pr_key(clp), 0, true);
+			nfsd4_scsi_pr_key(clp),
+			PR_EXCLUSIVE_ACCESS_REG_ONLY, true);
 }
 
 const struct nfsd4_layout_ops scsi_layout_ops = {
-- 
2.47.3


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH v3 2/2] NFSD: Add trace point for SCSI fencing operation.
  2025-11-05 20:45 [PATCH v3 0/2] NFSD: Fix problem with nfsd4_scsi_fence_client Dai Ngo
  2025-11-05 20:45 ` [PATCH v3 1/2] NFSD: use correct reservation type in nfsd4_scsi_fence_client Dai Ngo
@ 2025-11-05 20:45 ` Dai Ngo
  2025-11-06 16:14 ` [PATCH v3 0/2] NFSD: Fix problem with nfsd4_scsi_fence_client Chuck Lever
  2 siblings, 0 replies; 5+ messages in thread
From: Dai Ngo @ 2025-11-05 20:45 UTC (permalink / raw)
  To: chuck.lever, jlayton, neilb, okorniev, tom, hch; +Cc: linux-nfs

Add trace point to print client IP address, net namespace number,
device name and status of SCSI pr_preempt command.

Signed-off-by: Dai Ngo <dai.ngo@oracle.com>
---
 fs/nfsd/blocklayout.c |  5 ++++-
 fs/nfsd/trace.h       | 38 ++++++++++++++++++++++++++++++++++++++
 2 files changed, 42 insertions(+), 1 deletion(-)

diff --git a/fs/nfsd/blocklayout.c b/fs/nfsd/blocklayout.c
index 815c6e0cde5e..fd8a0995ab33 100644
--- a/fs/nfsd/blocklayout.c
+++ b/fs/nfsd/blocklayout.c
@@ -13,6 +13,7 @@
 #include "pnfs.h"
 #include "filecache.h"
 #include "vfs.h"
+#include "trace.h"
 
 #define NFSDDBG_FACILITY	NFSDDBG_PNFS
 
@@ -340,10 +341,12 @@ nfsd4_scsi_fence_client(struct nfs4_layout_stateid *ls, struct nfsd_file *file)
 {
 	struct nfs4_client *clp = ls->ls_stid.sc_client;
 	struct block_device *bdev = file->nf_file->f_path.mnt->mnt_sb->s_bdev;
+	int status;
 
-	bdev->bd_disk->fops->pr_ops->pr_preempt(bdev, NFSD_MDS_PR_KEY,
+	status = bdev->bd_disk->fops->pr_ops->pr_preempt(bdev, NFSD_MDS_PR_KEY,
 			nfsd4_scsi_pr_key(clp),
 			PR_EXCLUSIVE_ACCESS_REG_ONLY, true);
+	trace_nfsd_pnfs_fence(clp, bdev->bd_disk->disk_name, status);
 }
 
 const struct nfsd4_layout_ops scsi_layout_ops = {
diff --git a/fs/nfsd/trace.h b/fs/nfsd/trace.h
index 6e2c8e2aab10..9bfcd90aec9e 100644
--- a/fs/nfsd/trace.h
+++ b/fs/nfsd/trace.h
@@ -2613,6 +2613,44 @@ DEFINE_EVENT(nfsd_vfs_getattr_class, __name,		\
 DEFINE_NFSD_VFS_GETATTR_EVENT(nfsd_vfs_getattr);
 DEFINE_NFSD_VFS_GETATTR_EVENT(nfsd_vfs_statfs);
 
+DECLARE_EVENT_CLASS(nfsd_pnfs_class,
+	TP_PROTO(
+		const struct nfs4_client *clp,
+		const char *dev,
+		int error
+	),
+	TP_ARGS(clp, dev, error),
+	TP_STRUCT__entry(
+		__sockaddr(addr, sizeof(struct sockaddr_in6))
+		__field(unsigned int, netns_ino)
+		__string(dev, dev)
+		__field(u32, error)
+	),
+	TP_fast_assign(
+		__assign_sockaddr(addr, &clp->cl_addr,
+				sizeof(struct sockaddr_in6));
+		__entry->netns_ino = clp->net->ns.inum;
+		__assign_str(dev);
+		__entry->error = error;
+	),
+	TP_printk("client=%pISpc nn=%d dev=%s error=%d",
+		__get_sockaddr(addr),
+		__entry->netns_ino,
+		__get_str(dev),
+		__entry->error
+	)
+);
+
+#define DEFINE_NFSD_PNFS_ERR_EVENT(name)		\
+DEFINE_EVENT(nfsd_pnfs_class, nfsd_pnfs_##name,	\
+	TP_PROTO(					\
+		const struct nfs4_client *clp,		\
+		const char *dev,				\
+		int error				\
+	),						\
+	TP_ARGS(clp, dev, error))
+
+DEFINE_NFSD_PNFS_ERR_EVENT(fence);
 #endif /* _NFSD_TRACE_H */
 
 #undef TRACE_INCLUDE_PATH
-- 
2.47.3


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH v3 1/2] NFSD: use correct reservation type in nfsd4_scsi_fence_client
  2025-11-05 20:45 ` [PATCH v3 1/2] NFSD: use correct reservation type in nfsd4_scsi_fence_client Dai Ngo
@ 2025-11-06 11:43   ` Christoph Hellwig
  0 siblings, 0 replies; 5+ messages in thread
From: Christoph Hellwig @ 2025-11-06 11:43 UTC (permalink / raw)
  To: Dai Ngo; +Cc: chuck.lever, jlayton, neilb, okorniev, tom, linux-nfs

Looks good:

Reviewed-by: Christoph Hellwig <hch@lst.de>

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH v3 0/2] NFSD: Fix problem with nfsd4_scsi_fence_client
  2025-11-05 20:45 [PATCH v3 0/2] NFSD: Fix problem with nfsd4_scsi_fence_client Dai Ngo
  2025-11-05 20:45 ` [PATCH v3 1/2] NFSD: use correct reservation type in nfsd4_scsi_fence_client Dai Ngo
  2025-11-05 20:45 ` [PATCH v3 2/2] NFSD: Add trace point for SCSI fencing operation Dai Ngo
@ 2025-11-06 16:14 ` Chuck Lever
  2 siblings, 0 replies; 5+ messages in thread
From: Chuck Lever @ 2025-11-06 16:14 UTC (permalink / raw)
  To: jlayton, neilb, okorniev, tom, hch, Dai Ngo; +Cc: Chuck Lever, linux-nfs

From: Chuck Lever <chuck.lever@oracle.com>

On Wed, 05 Nov 2025 12:45:53 -0800, Dai Ngo wrote:
> This patchset includes the following:
> 
> . Fix problem with nfsd4_scsi_fence_client using the wrong reservation type.
> . Add trace point to track SCSI preempt operation.
> 
> v2:
> . drop patch that skips fencing on NFS4ERR_RETRY_UNCACHED_REP
> . add namespace number in output of fencing trace point
> 
> [...]

Applied to nfsd-testing, thanks!

[1/2] NFSD: use correct reservation type in nfsd4_scsi_fence_client
      commit: 7069b8dfa5a9ddd3e5c79e4d34e0b12ed0481a97
[2/2] NFSD: Add trace point for SCSI fencing operation.
      commit: 7af6ee667f4bbe500f1f4eac62ad1aea09716c79

--
Chuck Lever


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2025-11-06 16:14 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-11-05 20:45 [PATCH v3 0/2] NFSD: Fix problem with nfsd4_scsi_fence_client Dai Ngo
2025-11-05 20:45 ` [PATCH v3 1/2] NFSD: use correct reservation type in nfsd4_scsi_fence_client Dai Ngo
2025-11-06 11:43   ` Christoph Hellwig
2025-11-05 20:45 ` [PATCH v3 2/2] NFSD: Add trace point for SCSI fencing operation Dai Ngo
2025-11-06 16:14 ` [PATCH v3 0/2] NFSD: Fix problem with nfsd4_scsi_fence_client Chuck Lever

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.