Whamcloud - gitweb
Branch HEAD
authortappro <tappro>
Wed, 23 Sep 2009 17:57:06 +0000 (17:57 +0000)
committertappro <tappro>
Wed, 23 Sep 2009 17:57:06 +0000 (17:57 +0000)
b=3633
i=vitaly
i=zam

don't pass -ESTALE though when it is expected

lustre/mdc/mdc_reint.c
lustre/mdc/mdc_request.c
lustre/mdt/mdt_open.c

index 5199a82..58b97de 100644 (file)
@@ -165,7 +165,7 @@ int mdc_setattr(struct obd_export *exp, struct md_op_data *op_data,
 
         if (op_data->op_attr.ia_valid & (ATTR_MTIME | ATTR_CTIME))
                 CDEBUG(D_INODE, "setting mtime "CFS_TIME_T
-                      ", ctime "CFS_TIME_T"\n",
+                       ", ctime "CFS_TIME_T"\n",
                        LTIME_S(op_data->op_attr.ia_mtime),
                        LTIME_S(op_data->op_attr.ia_ctime));
         mdc_setattr_pack(req, op_data, ea, ealen, ea2, ea2len);
@@ -202,10 +202,13 @@ int mdc_setattr(struct obd_export *exp, struct md_op_data *op_data,
                 epoch->handle = body->handle;
                 epoch->ioepoch = body->ioepoch;
                 req->rq_replay_cb = mdc_replay_open;
+        /** bug 3633, open may be committed and estale answer is not error */
+        } else if (rc == -ESTALE && (op_data->op_flags & MF_SOM_CHANGE)) {
+                rc = 0;
+        } else if (rc == -ERESTARTSYS) {
+                rc = 0;
         }
         *request = req;
-        if (rc == -ERESTARTSYS)
-                rc = 0;
         if (rc && req->rq_commit_cb)
                 req->rq_commit_cb(req);
         RETURN(rc);
index 0fe780b..4af3f30 100644 (file)
@@ -829,6 +829,14 @@ int mdc_close(struct obd_export *exp, struct md_op_data *op_data,
                 body = req_capsule_server_get(&req->rq_pill, &RMF_MDT_BODY);
                 if (body == NULL)
                         rc = -EPROTO;
+        } else if (rc == -ESTALE) {
+                /**
+                 * it can be allowed error after 3633 if open was committed and
+                 * server failed before close was sent. Let's check if mod
+                 * exists and return no error in that case
+                 */
+                if (mod && (mod->mod_open_req == NULL))
+                        rc = 0;
         }
 
         if (rc != 0 && mod)
@@ -864,7 +872,7 @@ int mdc_done_writing(struct obd_export *exp, struct md_op_data *op_data,
 
                 mod->mod_close_req = req;
                 DEBUG_REQ(D_HA, mod->mod_open_req, "matched setattr");
-                /* We no longer want to preserve this open for replay even
+                /* We no longer want to preserve this setattr for replay even
                  * though the open was committed. b=3632, b=3633 */
                 spin_lock(&mod->mod_open_req->rq_lock);
                 mod->mod_open_req->rq_replay = 0;
@@ -878,6 +886,16 @@ int mdc_done_writing(struct obd_export *exp, struct md_op_data *op_data,
         rc = ptlrpc_queue_wait(req);
         mdc_put_rpc_lock(obd->u.cli.cl_close_lock, NULL);
 
+        if (rc == -ESTALE) {
+                /**
+                 * it can be allowed error after 3633 if open or setattr were
+                 * committed and server failed before close was sent.
+                 * Let's check if mod exists and return no error in that case
+                 */
+                if (mod && (mod->mod_open_req == NULL))
+                        rc = 0;
+        }
+
         ptlrpc_req_finished(req);
         RETURN(rc);
 }
index 99a391a..154bc46 100644 (file)
@@ -1358,7 +1358,8 @@ int mdt_close(struct mdt_thread_info *info)
                 CDEBUG(D_INODE, "no handle for file close: fid = "DFID
                        ": cookie = "LPX64"\n", PFID(info->mti_rr.rr_fid1),
                        info->mti_epoch->handle.cookie);
-                rc = err_serious(-ESTALE);
+                /** not serious error since bug 3633 */
+                rc = -ESTALE;
         } else {
                 class_handle_unhash(&mfd->mfd_handle);
                 list_del_init(&mfd->mfd_list);