Whamcloud - gitweb
b=4051
authoralex <alex>
Sat, 31 Jul 2004 14:49:46 +0000 (14:49 +0000)
committeralex <alex>
Sat, 31 Jul 2004 14:49:46 +0000 (14:49 +0000)
r=adilger

- lock inversion between mds_reint_unlink() and mdt_obj_create() fixed:
  mdt_obj_create() unlinks object, so it doesn't matter what directory
  to create objects in

lustre/include/linux/obd.h
lustre/mds/handler.c
lustre/mds/mds_fs.c

index dbcbd69..e88a9cc 100644 (file)
@@ -346,6 +346,7 @@ struct mds_obd {
         atomic_t                         mds_real_clients;
         struct obd_uuid                  mds_lmv_uuid;
         struct dentry                   *mds_fids_dir;
+        struct dentry                   *mds_unnamed_dir; /* for mdt_obd_create only */
 };
 
 struct echo_obd {
index b3057b5..94ad044 100644 (file)
@@ -1353,7 +1353,7 @@ static int mdt_obj_create(struct ptlrpc_request *req)
        
         DEBUG_REQ(D_HA, req, "create remote object");
 
-        parent_inode = mds->mds_objects_dir->d_inode;
+        parent_inode = mds->mds_unnamed_dir->d_inode;
 
         body = lustre_swab_reqbuf(req, 0, sizeof(*body), lustre_swab_ost_body);
         if (body == NULL)
@@ -1410,7 +1410,7 @@ static int mdt_obj_create(struct ptlrpc_request *req)
 
 repeat:
         rc = sprintf(fidname, "%u.%u", ll_insecure_random_int(), current->pid);
-        new = lookup_one_len(fidname, mds->mds_objects_dir, rc);
+        new = lookup_one_len(fidname, mds->mds_unnamed_dir, rc);
         if (IS_ERR(new)) {
                 CERROR("%s: can't lookup new inode (%s) for mkdir: %d\n",
                        obd->obd_name, fidname, (int) PTR_ERR(new));
index e26d84c..ddb6738 100644 (file)
@@ -477,6 +477,14 @@ int mds_fs_setup(struct obd_device *obd, struct vfsmount *mnt)
         }
         mds->mds_fids_dir = dentry;
 
+        dentry = simple_mkdir(current->fs->pwd, "UNNAMED", 0777, 1);
+        if (IS_ERR(dentry)) {
+                rc = PTR_ERR(dentry);
+                CERROR("cannot create UNNAMED directory: rc = %d\n", rc);
+                GOTO(err_unnamed, rc);
+        }
+        mds->mds_unnamed_dir = dentry;
+
         /* open and test the last rcvd file */
         file = filp_open(LAST_RCVD, O_RDWR | O_CREAT, 0644);
         if (IS_ERR(file)) {
@@ -527,6 +535,8 @@ err_client:
 err_last_rcvd:
         if (mds->mds_rcvd_filp && filp_close(mds->mds_rcvd_filp, 0))
                 CERROR("can't close %s after error\n", LAST_RCVD);
+err_unnamed:
+        dput(mds->mds_unnamed_dir);
 err_fids:
         dput(mds->mds_fids_dir);
 err_objects:
@@ -573,6 +583,10 @@ int mds_fs_cleanup(struct obd_device *obd, int flags)
                 if (rc)
                         CERROR("%s file won't close, rc=%d\n", LOV_OBJID, rc);
         }
+        if (mds->mds_unnamed_dir != NULL) {
+                l_dput(mds->mds_unnamed_dir);
+                mds->mds_unnamed_dir = NULL;
+        }
         if (mds->mds_fids_dir != NULL) {
                 l_dput(mds->mds_fids_dir);
                 mds->mds_fids_dir = NULL;