Whamcloud - gitweb
b=22768 mdt open error handling
authorVitaly Fertman <Vitaly.Fertman@sun.com>
Thu, 17 Jun 2010 11:01:04 +0000 (15:01 +0400)
committerRobert Read <robert.read@oracle.com>
Thu, 17 Jun 2010 21:19:36 +0000 (14:19 -0700)
i=green
i=rread

mdt_finish_open() may return an error, which must result in unlocking
the object and returning it to client

lustre/mdt/mdt_handler.c
lustre/mdt/mdt_open.c

index 3583a2b..bf0f760 100644 (file)
@@ -3411,6 +3411,8 @@ static int mdt_intent_reint(enum mdt_it_code opcode,
                   * checked here.
                   */
                 if (lustre_handle_is_used(&lhc->mlh_reg_lh)) {
                   * checked here.
                   */
                 if (lustre_handle_is_used(&lhc->mlh_reg_lh)) {
+                        LASSERTF(rc == 0, "Error occurred but lock handle "
+                                 "is still in use\n");
                         rep->lock_policy_res2 = 0;
                         rc = mdt_intent_lock_replace(info, lockp, NULL, lhc, flags);
                         RETURN(rc);
                         rep->lock_policy_res2 = 0;
                         rc = mdt_intent_lock_replace(info, lockp, NULL, lhc, flags);
                         RETURN(rc);
index ee8d062..2aef7e7 100644 (file)
@@ -1078,7 +1078,7 @@ static int mdt_open_anon_by_fid(struct mdt_thread_info* info,
                 mdt_set_disposition(info, rep, DISP_OPEN_LOCK);
         rc = mdt_finish_open(info, NULL, o, flags, 0, rep);
 
                 mdt_set_disposition(info, rep, DISP_OPEN_LOCK);
         rc = mdt_finish_open(info, NULL, o, flags, 0, rep);
 
-        if (!(flags & MDS_OPEN_LOCK))
+        if (!(flags & MDS_OPEN_LOCK) || rc)
                 mdt_object_unlock(info, o, lhc, 1);
 
         GOTO(out, rc);
                 mdt_object_unlock(info, o, lhc, 1);
 
         GOTO(out, rc);