ceph: move wait for mds request into helper function
authorJeff Layton <jlayton@kernel.org>
Tue, 2 Apr 2019 16:34:38 +0000 (12:34 -0400)
committerIlya Dryomov <idryomov@gmail.com>
Tue, 7 May 2019 17:22:38 +0000 (19:22 +0200)
Signed-off-by: Jeff Layton <jlayton@kernel.org>
Reviewed-by: "Yan, Zheng" <zyan@redhat.com>
Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
fs/ceph/mds_client.c

index ffbb98fdc478a20fbe3d64c00da87165386aacfe..0026ca094e22b72e33a2b4fe8a9bd94e93ef77a4 100644 (file)
@@ -2649,23 +2649,11 @@ int ceph_mdsc_submit_request(struct ceph_mds_client *mdsc, struct inode *dir,
        return err;
 }
 
-/*
- * Synchrously perform an mds request.  Take care of all of the
- * session setup, forwarding, retry details.
- */
-int ceph_mdsc_do_request(struct ceph_mds_client *mdsc,
-                        struct inode *dir,
-                        struct ceph_mds_request *req)
+static int ceph_mdsc_wait_request(struct ceph_mds_client *mdsc,
+                                 struct ceph_mds_request *req)
 {
        int err;
 
-       dout("do_request on %p\n", req);
-
-       /* issue */
-       err = ceph_mdsc_submit_request(mdsc, dir, req);
-       if (err)
-               goto out;
-
        /* wait */
        dout("do_request waiting\n");
        if (!req->r_timeout && req->r_wait_for_completion) {
@@ -2708,7 +2696,25 @@ int ceph_mdsc_do_request(struct ceph_mds_client *mdsc,
        }
 
        mutex_unlock(&mdsc->mutex);
-out:
+       return err;
+}
+
+/*
+ * Synchrously perform an mds request.  Take care of all of the
+ * session setup, forwarding, retry details.
+ */
+int ceph_mdsc_do_request(struct ceph_mds_client *mdsc,
+                        struct inode *dir,
+                        struct ceph_mds_request *req)
+{
+       int err;
+
+       dout("do_request on %p\n", req);
+
+       /* issue */
+       err = ceph_mdsc_submit_request(mdsc, dir, req);
+       if (!err)
+               err = ceph_mdsc_wait_request(mdsc, req);
        dout("do_request %p done, result %d\n", req, err);
        return err;
 }