Whamcloud - gitweb
LU-1064 mds: fix mds_lookup lma removal error path
authorAndreas Dilger <adilger@whamcloud.com>
Sat, 1 Dec 2012 07:15:34 +0000 (00:15 -0700)
committerJohann Lombardi <johann.lombardi@intel.com>
Mon, 3 Dec 2012 08:12:47 +0000 (03:12 -0500)
In commit 1fd243c89e3b221d40ce74b8ef47f1bca760c8f9 if an error is hit
removing the "lma" xattr from an updated 2.x inode, then the open
transaction handle would never be committed, and the MDS would hang.

This is unlikely to be a problem, as the only errors fsfilt_set_md()
will hit that are not programming bugs are due to IO errors from the
underlying disk (which is an even bigger problem).

Make sure that the transaction is committed, even after an error.

Signed-off-by: Andreas Dilger <adilger@whamcloud.com>
Change-Id: If7d19a2337a12efafacd20d5c4e5c00e85300c1e
Reviewed-on: http://review.whamcloud.com/4729
Tested-by: Hudson
Reviewed-by: Iurii Golovach <Iurii_Golovach@xyratex.com>
Tested-by: Maloo <whamcloud.maloo@gmail.com>
Reviewed-by: Johann Lombardi <johann.lombardi@intel.com>
lustre/mds/mds_reint.c

index b4bc750..a47e844 100644 (file)
@@ -97,19 +97,19 @@ struct dentry *mds_lookup(struct obd_device *obd, const char *fid_name,
         if (!IS_ERR(dchild) && (dchild->d_inode != NULL) &&
             unlikely((lsd->lsd_feature_incompat & OBD_INCOMPAT_FID) ||
                       OBD_FAIL_CHECK(OBD_FAIL_MDS_REMOVE_COMMON_EA))) {
-                struct inode *inode = dchild->d_inode; 
+                struct inode *inode = dchild->d_inode;
                 void         *handle;
 
                 LOCK_INODE_MUTEX(inode);
                 if (fsfilt_get_md(obd, inode, NULL, 0, "lma") > 0) {
+                        int rc2;
+
                         handle = fsfilt_start(obd, inode,
                                               FSFILT_OP_SETATTR, NULL);
                         if (IS_ERR(handle))
                                 GOTO(err, rc = PTR_ERR(handle));
 
                         rc = fsfilt_set_md(obd, inode, handle, NULL, 0, "lma");
-                        if (rc)
-                                GOTO(err, rc);
 
                         /* Force sync. Needed to avoid a case when client gets
                          * IGIF, MDS fails to write this info to disk, upgrade
@@ -119,9 +119,9 @@ struct dentry *mds_lookup(struct obd_device *obd, const char *fid_name,
                          * with LMA, i.e. created after upgrade.
                          * As downgrade is an emergency unexpected case, this
                          * is a feasible way. */
-                        rc = fsfilt_commit(obd, inode, handle, 1);
-                        if (rc)
-                                GOTO(err, rc);
+                        rc2 = fsfilt_commit(obd, inode, handle, 1);
+                        if (rc != 0 || rc2 != 0)
+                                GOTO(err, rc = rc ?: rc2);
                 }
                 UNLOCK_INODE_MUTEX(inode);
         }