From: NeilBrown <neilb@suse.de>
To: Trond Myklebust <trondmy@kernel.org>, Anna Schumaker <anna@kernel.org>
Cc: linux-nfs@vger.kernel.org
Subject: [PATCH 08/11] nfs: discard nfs_wait_bit_killable()
Date: Fri, 6 Dec 2024 13:15:34 +1100 [thread overview]
Message-ID: <20241206021830.3526922-9-neilb@suse.de> (raw)
In-Reply-To: <20241206021830.3526922-1-neilb@suse.de>
This patch changes NFS to use wait_on_bit() instead of
wait_on_bit_action()
nfs_wait_bit_killable() is identical to bit_wait() except that it
returns -ERESTARTSYS instead of -EINTR. NFS doesn't care about this
distinction. The status will often get back to user-space but it will
only be sent when the process is being killed in which case there is no
user-space to care.
Signed-off-by: NeilBrown <neilb@suse.de>
---
fs/nfs/file.c | 5 ++---
fs/nfs/inode.c | 14 ++------------
fs/nfs/internal.h | 1 -
fs/nfs/nfs4state.c | 5 ++---
fs/nfs/pnfs.c | 9 +++------
5 files changed, 9 insertions(+), 25 deletions(-)
diff --git a/fs/nfs/file.c b/fs/nfs/file.c
index 1bb646752e46..0fafdfec5886 100644
--- a/fs/nfs/file.c
+++ b/fs/nfs/file.c
@@ -607,9 +607,8 @@ static vm_fault_t nfs_vm_page_mkwrite(struct vm_fault *vmf)
goto out;
}
- wait_on_bit_action(&NFS_I(inode)->flags, NFS_INO_INVALIDATING,
- nfs_wait_bit_killable,
- TASK_KILLABLE|TASK_FREEZABLE_UNSAFE);
+ wait_on_bit(&NFS_I(inode)->flags, NFS_INO_INVALIDATING,
+ TASK_KILLABLE|TASK_FREEZABLE_UNSAFE);
folio_lock(folio);
mapping = folio->mapping;
diff --git a/fs/nfs/inode.c b/fs/nfs/inode.c
index 4c4c3ab57fcd..2f1b4f11a056 100644
--- a/fs/nfs/inode.c
+++ b/fs/nfs/inode.c
@@ -72,15 +72,6 @@ nfs_fattr_to_ino_t(struct nfs_fattr *fattr)
return nfs_fileid_to_ino_t(fattr->fileid);
}
-int nfs_wait_bit_killable(struct wait_bit_key *key, int mode)
-{
- schedule();
- if (signal_pending_state(mode, current))
- return -ERESTARTSYS;
- return 0;
-}
-EXPORT_SYMBOL_GPL(nfs_wait_bit_killable);
-
/**
* nfs_compat_user_ino64 - returns the user-visible inode number
* @fileid: 64-bit fileid
@@ -1419,9 +1410,8 @@ int nfs_clear_invalid_mapping(struct address_space *mapping)
* the bit lock here if it looks like we're going to be doing that.
*/
for (;;) {
- ret = wait_on_bit_action(bitlock, NFS_INO_INVALIDATING,
- nfs_wait_bit_killable,
- TASK_KILLABLE|TASK_FREEZABLE_UNSAFE);
+ ret = wait_on_bit(bitlock, NFS_INO_INVALIDATING,
+ TASK_KILLABLE|TASK_FREEZABLE_UNSAFE);
if (ret)
goto out;
smp_rmb(); /* pairs with smp_wmb() below */
diff --git a/fs/nfs/internal.h b/fs/nfs/internal.h
index e564bd11ba60..1ec10fa50830 100644
--- a/fs/nfs/internal.h
+++ b/fs/nfs/internal.h
@@ -451,7 +451,6 @@ extern void nfs_evict_inode(struct inode *);
extern void nfs_zap_acl_cache(struct inode *inode);
extern void nfs_set_cache_invalid(struct inode *inode, unsigned long flags);
extern bool nfs_check_cache_invalid(struct inode *, unsigned long);
-extern int nfs_wait_bit_killable(struct wait_bit_key *key, int mode);
#if IS_ENABLED(CONFIG_NFS_LOCALIO)
/* localio.c */
diff --git a/fs/nfs/nfs4state.c b/fs/nfs/nfs4state.c
index 9a9f60a2291b..556b521f17eb 100644
--- a/fs/nfs/nfs4state.c
+++ b/fs/nfs/nfs4state.c
@@ -1313,9 +1313,8 @@ int nfs4_wait_clnt_recover(struct nfs_client *clp)
might_sleep();
refcount_inc(&clp->cl_count);
- res = wait_on_bit_action(&clp->cl_state, NFS4CLNT_MANAGER_RUNNING,
- nfs_wait_bit_killable,
- TASK_KILLABLE|TASK_FREEZABLE_UNSAFE);
+ res = wait_on_bit(&clp->cl_state, NFS4CLNT_MANAGER_RUNNING,
+ TASK_KILLABLE|TASK_FREEZABLE_UNSAFE);
if (res)
goto out;
if (clp->cl_cons_state < 0)
diff --git a/fs/nfs/pnfs.c b/fs/nfs/pnfs.c
index 445ba09ba324..400f409f45fa 100644
--- a/fs/nfs/pnfs.c
+++ b/fs/nfs/pnfs.c
@@ -2022,9 +2022,8 @@ static int pnfs_prepare_to_retry_layoutget(struct pnfs_layout_hdr *lo)
* reference
*/
pnfs_layoutcommit_inode(lo->plh_inode, false);
- return wait_on_bit_action(&lo->plh_flags, NFS_LAYOUT_RETURN,
- nfs_wait_bit_killable,
- TASK_KILLABLE|TASK_FREEZABLE_UNSAFE);
+ return wait_on_bit(&lo->plh_flags, NFS_LAYOUT_RETURN,
+ TASK_KILLABLE|TASK_FREEZABLE_UNSAFE);
}
static void nfs_layoutget_begin(struct pnfs_layout_hdr *lo)
@@ -3319,9 +3318,8 @@ pnfs_layoutcommit_inode(struct inode *inode, bool sync)
if (test_and_set_bit(NFS_INO_LAYOUTCOMMITTING, &nfsi->flags)) {
if (!sync)
goto out;
- status = wait_on_bit_lock_action(&nfsi->flags,
+ status = wait_on_bit_lock(&nfsi->flags,
NFS_INO_LAYOUTCOMMITTING,
- nfs_wait_bit_killable,
TASK_KILLABLE|TASK_FREEZABLE_UNSAFE);
if (status)
goto out;
@@ -3369,7 +3367,6 @@ pnfs_layoutcommit_inode(struct inode *inode, bool sync)
}
}
-
status = nfs4_proc_layoutcommit(data, sync);
out:
if (status)
--
2.47.0
next prev parent reply other threads:[~2024-12-06 2:19 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-12-06 2:15 [PATCH 00/11] nfs: improve use of wake_up_bit and wake_up_var NeilBrown
2024-12-06 2:15 ` [PATCH 01/11] sunrpc: remove explicit barrier from rpc_make_runnable() NeilBrown
2024-12-06 2:15 ` [PATCH 02/11] sunrpc: use clear_and_wake_up_bit() for XPRT_LOCKED NeilBrown
2024-12-06 2:15 ` [PATCH 03/11] nfs: use clear_and_wake_up_bit() NeilBrown
2024-12-06 2:15 ` [PATCH 04/11] nfs: combine NFS_LAYOUT_RETURN and NFS_LAYOUT_RETURN_LOCK NeilBrown
2025-01-22 20:45 ` Mike Snitzer
2025-01-22 21:25 ` NeilBrown
2024-12-06 2:15 ` [PATCH 05/11] nfs: use clear_and_wake_up_bit() in pnfs code NeilBrown
2024-12-06 2:15 ` [PATCH 06/11] nfs: use store_release_wake_up() for clearing d_fsdata NeilBrown
2024-12-06 2:15 ` [PATCH 07/11] sunrpc: discard rpc_wait_bit_killable() NeilBrown
2024-12-06 2:15 ` NeilBrown [this message]
2024-12-06 2:15 ` [PATCH 09/11] nfs: add memory barrier before calling wake_up_var on cl_state NeilBrown
2024-12-06 2:15 ` [PATCH 10/11] nfs: use atomic_dec_and_wake_up() NeilBrown
2024-12-06 2:15 ` [PATCH 11/11] nfs: use wait_var_event_spinlock() to wait for nfsi->layout to change NeilBrown
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=20241206021830.3526922-9-neilb@suse.de \
--to=neilb@suse.de \
--cc=anna@kernel.org \
--cc=linux-nfs@vger.kernel.org \
--cc=trondmy@kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox