Whamcloud - gitweb
Branch: HEAD
authorwangdi <wangdi>
Wed, 9 Mar 2005 08:01:06 +0000 (08:01 +0000)
committerwangdi <wangdi>
Wed, 9 Mar 2005 08:01:06 +0000 (08:01 +0000)
Log:
we should lock the ino not fid in mds_lock_new_child, for protect ino being reused after unlink.
b:5843
r:alex

lustre/mds/mds_open.c

index 3a8fd77..9d947a1 100644 (file)
@@ -789,24 +789,11 @@ int mds_pin(struct ptlrpc_request *req, int offset)
 int mds_lock_new_child(struct obd_device *obd, struct inode *inode,
                        struct lustre_handle *child_lockh)
 {
-        struct ldlm_res_id child_res_id = { .name = { 0, 0, 0, 0 } };
+        struct ldlm_res_id child_res_id = { .name = { inode->i_ino, 0, 1, 0 } };
         struct lustre_handle lockh;
-        struct lustre_id sid;
         int lock_flags = 0;
         int rc;
 
-        down(&inode->i_sem);
-        rc = mds_read_inode_sid(obd, inode, &sid);
-        up(&inode->i_sem);
-        if (rc) {
-                CERROR("Can't read inode self id, err = %d\n", rc);
-                RETURN(rc);
-        }
-
-        child_res_id.name[0] = id_fid(&sid);
-        child_res_id.name[1] = id_group(&sid);
-        child_res_id.name[2] = 1;
-
         if (child_lockh == NULL)
                 child_lockh = &lockh;