]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
NFS: Split out the nfs40_nograce_recovery_ops into nfs40proc.c
authorAnna Schumaker <anna.schumaker@oracle.com>
Thu, 13 Nov 2025 18:17:59 +0000 (13:17 -0500)
committerAnna Schumaker <anna.schumaker@oracle.com>
Fri, 30 Jan 2026 16:42:20 +0000 (11:42 -0500)
Signed-off-by: Anna Schumaker <anna.schumaker@oracle.com>
fs/nfs/nfs40.h
fs/nfs/nfs40proc.c
fs/nfs/nfs4_fs.h
fs/nfs/nfs4proc.c

index ad57172b49a3a16a9a04f4dd5ce92cca53c131bd..c64e5ff6c9ff524ed883f3ce2631d27462ee749a 100644 (file)
@@ -6,6 +6,7 @@
 /* nfs40proc.c */
 extern const struct rpc_call_ops nfs40_call_sync_ops;
 extern const struct nfs4_state_recovery_ops nfs40_reboot_recovery_ops;
+extern const struct nfs4_state_recovery_ops nfs40_nograce_recovery_ops;
 
 /* nfs40state.c */
 int nfs40_discover_server_trunking(struct nfs_client *clp,
index b2cc7519b226509f7b964ebaae5f2fe691f747ed..867afdf4ecf4fc287de6dda57c84309824353dbe 100644 (file)
@@ -18,6 +18,20 @@ static void nfs40_call_sync_done(struct rpc_task *task, void *calldata)
        nfs4_sequence_done(task, data->seq_res);
 }
 
+static void nfs40_clear_delegation_stateid(struct nfs4_state *state)
+{
+       if (rcu_access_pointer(NFS_I(state->inode)->delegation) != NULL)
+               nfs_finish_clear_delegation_stateid(state, NULL);
+}
+
+static int nfs40_open_expired(struct nfs4_state_owner *sp, struct nfs4_state *state)
+{
+       /* NFSv4.0 doesn't allow for delegation recovery on open expire */
+       nfs40_clear_delegation_stateid(state);
+       nfs_state_clear_open_state_flags(state);
+       return nfs4_open_expired(sp, state);
+}
+
 const struct rpc_call_ops nfs40_call_sync_ops = {
        .rpc_call_prepare = nfs40_call_sync_prepare,
        .rpc_call_done = nfs40_call_sync_done,
@@ -31,3 +45,11 @@ const struct nfs4_state_recovery_ops nfs40_reboot_recovery_ops = {
        .establish_clid = nfs4_init_clientid,
        .detect_trunking = nfs40_discover_server_trunking,
 };
+
+const struct nfs4_state_recovery_ops nfs40_nograce_recovery_ops = {
+       .owner_flag_bit = NFS_OWNER_RECLAIM_NOGRACE,
+       .state_flag_bit = NFS_STATE_RECLAIM_NOGRACE,
+       .recover_open   = nfs40_open_expired,
+       .recover_lock   = nfs4_lock_expired,
+       .establish_clid = nfs4_init_clientid,
+};
index 246a43d172f9962210eae57ca0bbca7346e386c4..885a78a3c22c17a1085981fe2066db56a750812f 100644 (file)
@@ -351,7 +351,13 @@ extern void nfs4_update_changeattr(struct inode *dir,
 extern int nfs4_buf_to_pages_noslab(const void *buf, size_t buflen,
                                    struct page **pages);
 extern int nfs4_open_reclaim(struct nfs4_state_owner *, struct nfs4_state *);
+extern int nfs4_open_expired(struct nfs4_state_owner *, struct nfs4_state *);
 extern int nfs4_lock_reclaim(struct nfs4_state *state, struct file_lock *request);
+extern int nfs4_lock_expired(struct nfs4_state *state, struct file_lock *request);
+extern void nfs_state_clear_delegation(struct nfs4_state *state);
+extern void nfs_finish_clear_delegation_stateid(struct nfs4_state *state,
+                                               const nfs4_stateid *stateid);
+extern void nfs_state_clear_open_state_flags(struct nfs4_state *state);
 
 #if defined(CONFIG_NFS_V4_1)
 extern int nfs41_sequence_done(struct rpc_task *, struct nfs4_sequence_res *);
index e3047bd989a514d3754968bea468f33f5d57d881..a4529b375f881a4503b02f413f8f8018a68791e2 100644 (file)
@@ -1848,7 +1848,7 @@ static void nfs_state_set_open_stateid(struct nfs4_state *state,
        write_sequnlock(&state->seqlock);
 }
 
-static void nfs_state_clear_open_state_flags(struct nfs4_state *state)
+void nfs_state_clear_open_state_flags(struct nfs4_state *state)
 {
        clear_bit(NFS_O_RDWR_STATE, &state->flags);
        clear_bit(NFS_O_WRONLY_STATE, &state->flags);
@@ -1870,7 +1870,7 @@ static void nfs_state_set_delegation(struct nfs4_state *state,
        write_sequnlock(&state->seqlock);
 }
 
-static void nfs_state_clear_delegation(struct nfs4_state *state)
+void nfs_state_clear_delegation(struct nfs4_state *state)
 {
        write_seqlock(&state->seqlock);
        nfs4_stateid_copy(&state->stateid, &state->open_stateid);
@@ -2862,7 +2862,7 @@ out:
        return err;
 }
 
-static int nfs4_open_expired(struct nfs4_state_owner *sp, struct nfs4_state *state)
+int nfs4_open_expired(struct nfs4_state_owner *sp, struct nfs4_state *state)
 {
        struct nfs_open_context *ctx;
        int ret;
@@ -2875,27 +2875,13 @@ static int nfs4_open_expired(struct nfs4_state_owner *sp, struct nfs4_state *sta
        return ret;
 }
 
-static void nfs_finish_clear_delegation_stateid(struct nfs4_state *state,
+void nfs_finish_clear_delegation_stateid(struct nfs4_state *state,
                const nfs4_stateid *stateid)
 {
        nfs_remove_bad_delegation(state->inode, stateid);
        nfs_state_clear_delegation(state);
 }
 
-static void nfs40_clear_delegation_stateid(struct nfs4_state *state)
-{
-       if (rcu_access_pointer(NFS_I(state->inode)->delegation) != NULL)
-               nfs_finish_clear_delegation_stateid(state, NULL);
-}
-
-static int nfs40_open_expired(struct nfs4_state_owner *sp, struct nfs4_state *state)
-{
-       /* NFSv4.0 doesn't allow for delegation recovery on open expire */
-       nfs40_clear_delegation_stateid(state);
-       nfs_state_clear_open_state_flags(state);
-       return nfs4_open_expired(sp, state);
-}
-
 static int nfs40_test_and_free_expired_stateid(struct nfs_server *server,
                                               nfs4_stateid *stateid, const struct cred *cred)
 {
@@ -7669,7 +7655,7 @@ int nfs4_lock_reclaim(struct nfs4_state *state, struct file_lock *request)
        return err;
 }
 
-static int nfs4_lock_expired(struct nfs4_state *state, struct file_lock *request)
+int nfs4_lock_expired(struct nfs4_state *state, struct file_lock *request)
 {
        struct nfs_server *server = NFS_SERVER(state->inode);
        struct nfs4_exception exception = {
@@ -10814,17 +10800,7 @@ static const struct nfs4_state_recovery_ops nfs41_reboot_recovery_ops = {
        .reclaim_complete = nfs41_proc_reclaim_complete,
        .detect_trunking = nfs41_discover_server_trunking,
 };
-#endif /* CONFIG_NFS_V4_1 */
-
-static const struct nfs4_state_recovery_ops nfs40_nograce_recovery_ops = {
-       .owner_flag_bit = NFS_OWNER_RECLAIM_NOGRACE,
-       .state_flag_bit = NFS_STATE_RECLAIM_NOGRACE,
-       .recover_open   = nfs40_open_expired,
-       .recover_lock   = nfs4_lock_expired,
-       .establish_clid = nfs4_init_clientid,
-};
 
-#if defined(CONFIG_NFS_V4_1)
 static const struct nfs4_state_recovery_ops nfs41_nograce_recovery_ops = {
        .owner_flag_bit = NFS_OWNER_RECLAIM_NOGRACE,
        .state_flag_bit = NFS_STATE_RECLAIM_NOGRACE,