]> git.baikalelectronics.ru Git - kernel.git/commitdiff
afs: Fix the maximum lifespan of VL and probe calls
authorDavid Howells <dhowells@redhat.com>
Thu, 16 May 2019 12:21:59 +0000 (13:21 +0100)
committerDavid Howells <dhowells@redhat.com>
Thu, 16 May 2019 15:25:20 +0000 (16:25 +0100)
If an older AFS server doesn't support an operation, it may accept the call
and then sit on it forever, happily responding to pings that make kafs
think that the call is still alive.

Fix this by setting the maximum lifespan of Volume Location service calls
in particular and probe calls in general so that they don't run on
endlessly if they're not supported.

Signed-off-by: David Howells <dhowells@redhat.com>
fs/afs/afs.h
fs/afs/fsclient.c
fs/afs/internal.h
fs/afs/rxrpc.c
fs/afs/vlclient.c

index d12ffb457e4745809460707c02176d2e4a657e4b..74913c707bba73f7093eb53d07f93937bd196cb2 100644 (file)
@@ -23,6 +23,9 @@
 #define AFSPATHMAX             1024    /* Maximum length of a pathname plus NUL */
 #define AFSOPAQUEMAX           1024    /* Maximum length of an opaque field */
 
+#define AFS_VL_MAX_LIFESPAN    (120 * HZ)
+#define AFS_PROBE_MAX_LIFESPAN (30 * HZ)
+
 typedef u64                    afs_volid_t;
 typedef u64                    afs_vnodeid_t;
 typedef u64                    afs_dataversion_t;
index 1296f5dc4c1e5f23e0019701646d35080dbbdf26..7051b58d8a559ccfab2d31054ece988fadf14f02 100644 (file)
@@ -2115,6 +2115,7 @@ struct afs_call *afs_fs_get_capabilities(struct afs_net *net,
        call->upgrade = true;
        call->want_reply_time = true;
        call->async = true;
+       call->max_lifespan = AFS_PROBE_MAX_LIFESPAN;
 
        /* marshall the parameters */
        bp = call->request;
index 50d925f0a556a8f5f0f9e915cf3671ddca1db67c..4765c6716242fd5b41b31d4c1ef945e0276cacdb 100644 (file)
@@ -131,6 +131,7 @@ struct afs_call {
        int                     error;          /* error code */
        u32                     abort_code;     /* Remote abort ID or 0 */
        u32                     epoch;
+       unsigned int            max_lifespan;   /* Maximum lifespan to set if not 0 */
        unsigned                request_size;   /* size of request data */
        unsigned                reply_max;      /* maximum size of reply */
        unsigned                first_offset;   /* offset into mapping[first] */
index a34a89c75c6ac6e75195c0b9f5675aff10008bbf..4974defb45924b0c726ede65c8ec7bff01130e1e 100644 (file)
@@ -426,6 +426,10 @@ void afs_make_call(struct afs_addr_cursor *ac, struct afs_call *call, gfp_t gfp)
 
        call->rxcall = rxcall;
 
+       if (call->max_lifespan)
+               rxrpc_kernel_set_max_life(call->net->socket, rxcall,
+                                         call->max_lifespan);
+
        /* send the request */
        iov[0].iov_base = call->request;
        iov[0].iov_len  = call->request_size;
index dd9ba4e96fb3ecc14d2fe4552fe209a09e6b2abc..7c53768a360b4461bc6a1e905a8daab90d3620bb 100644 (file)
@@ -157,6 +157,7 @@ struct afs_vldb_entry *afs_vl_get_entry_by_name_u(struct afs_vl_cursor *vc,
        call->key = vc->key;
        call->reply[0] = entry;
        call->ret_reply0 = true;
+       call->max_lifespan = AFS_VL_MAX_LIFESPAN;
 
        /* Marshall the parameters */
        bp = call->request;
@@ -289,6 +290,7 @@ struct afs_addr_list *afs_vl_get_addrs_u(struct afs_vl_cursor *vc,
        call->key = vc->key;
        call->reply[0] = NULL;
        call->ret_reply0 = true;
+       call->max_lifespan = AFS_VL_MAX_LIFESPAN;
 
        /* Marshall the parameters */
        bp = call->request;
@@ -403,6 +405,7 @@ struct afs_call *afs_vl_get_capabilities(struct afs_net *net,
        call->upgrade = true;
        call->want_reply_time = true;
        call->async = true;
+       call->max_lifespan = AFS_PROBE_MAX_LIFESPAN;
 
        /* marshall the parameters */
        bp = call->request;
@@ -646,6 +649,7 @@ struct afs_addr_list *afs_yfsvl_get_endpoints(struct afs_vl_cursor *vc,
        call->key = vc->key;
        call->reply[0] = NULL;
        call->ret_reply0 = true;
+       call->max_lifespan = AFS_VL_MAX_LIFESPAN;
 
        /* Marshall the parameters */
        bp = call->request;