]> git.apps.os.sepia.ceph.com Git - ceph-client.git/commitdiff
ceph: add flag to delegate an inode number for async create
authorJeff Layton <jlayton@kernel.org>
Mon, 2 Dec 2019 18:47:57 +0000 (13:47 -0500)
committerJeff Layton <jlayton@kernel.org>
Fri, 10 Jan 2020 16:51:05 +0000 (11:51 -0500)
In order to issue an async create request, we need to send an inode
number when we do the request, but we don't know which to which MDS
we'll be issuing the request.

Add a new r_req_flag that tells the request sending machinery to
grab an inode number from the delegated set, and encode it into the
request. If it can't get one then have it return -ECHILD. The
requestor can then reissue a synchronous request.

Signed-off-by: Jeff Layton <jlayton@kernel.org>
fs/ceph/inode.c
fs/ceph/mds_client.c
fs/ceph/mds_client.h

index 79bb1e6af09064ecf0d3ffd9f3e91a3fbb4c8b59..9cfc093fd273f1b2bbbd67f7659e34cd3d874eae 100644 (file)
@@ -1317,6 +1317,7 @@ retry_lookup:
                err = ceph_fill_inode(in, req->r_locked_page, &rinfo->targeti,
                                NULL, session,
                                (!test_bit(CEPH_MDS_R_ABORTED, &req->r_req_flags) &&
+                                !test_bit(CEPH_MDS_R_DELEG_INO, &req->r_req_flags) &&
                                 rinfo->head->result == 0) ?  req->r_fmode : -1,
                                &req->r_caps_reservation);
                if (err < 0) {
index 852c46550d969b1920daf20703a23357ad99e111..9e7492b21b50b26e422ed02a8edc5605525675f6 100644 (file)
@@ -2623,7 +2623,10 @@ static int __prepare_send_request(struct ceph_mds_client *mdsc,
        rhead->flags = cpu_to_le32(flags);
        rhead->num_fwd = req->r_num_fwd;
        rhead->num_retry = req->r_attempts - 1;
-       rhead->ino = 0;
+       if (test_bit(CEPH_MDS_R_DELEG_INO, &req->r_req_flags))
+               rhead->ino = cpu_to_le64(req->r_deleg_ino);
+       else
+               rhead->ino = 0;
 
        dout(" r_parent = %p\n", req->r_parent);
        return 0;
@@ -2736,6 +2739,20 @@ static void __do_request(struct ceph_mds_client *mdsc,
                goto out_session;
        }
 
+       if (test_bit(CEPH_MDS_R_DELEG_INO, &req->r_req_flags) &&
+           !req->r_deleg_ino) {
+               req->r_deleg_ino = get_delegated_ino(req->r_session);
+
+               if (!req->r_deleg_ino) {
+                       /*
+                        * If we can't get a deleg ino, exit with -ECHILD,
+                        * so the caller can reissue a sync request
+                        */
+                       err = -ECHILD;
+                       goto out_session;
+               }
+       }
+
        /* send request */
        req->r_resend_mds = -1;   /* forget any previous mds hint */
 
index 3db7ef47e1c95af15cde3f371fe8eedc98821bec..e0b36be7c44f04b242575f812b3e40c6c4dd792f 100644 (file)
@@ -258,6 +258,7 @@ struct ceph_mds_request {
 #define CEPH_MDS_R_GOT_RESULT          (5) /* got a result */
 #define CEPH_MDS_R_DID_PREPOPULATE     (6) /* prepopulated readdir */
 #define CEPH_MDS_R_PARENT_LOCKED       (7) /* is r_parent->i_rwsem wlocked? */
+#define CEPH_MDS_R_DELEG_INO           (8) /* attempt to get r_deleg_ino */
        unsigned long   r_req_flags;
 
        struct mutex r_fill_mutex;
@@ -307,6 +308,7 @@ struct ceph_mds_request {
        int               r_num_fwd;    /* number of forward attempts */
        int               r_resend_mds; /* mds to resend to next, if any*/
        u32               r_sent_on_mseq; /* cap mseq request was sent at*/
+       unsigned long     r_deleg_ino;
 
        struct list_head  r_wait;
        struct completion r_completion;