Whamcloud - gitweb
b=22190 return error on write if rdonly mode is on, don't reply if umount
[fs/lustre-release.git] / lustre / ost / ost_handler.c
index c8473da..638536a 100644 (file)
@@ -681,7 +681,6 @@ static int ost_brw_read(struct ptlrpc_request *req, struct obd_trans_info *oti)
                 }
         }
 
-        req_capsule_set_size(&req->rq_pill, &RMF_RCS, RCL_SERVER, 0);
         rc = req_capsule_server_pack(&req->rq_pill);
         if (rc)
                 GOTO(out, rc);
@@ -1130,6 +1129,13 @@ static int ost_brw_write(struct ptlrpc_request *req, struct obd_trans_info *oti)
                 repbody->oa.o_gid = o_gid;
         }
 
+        /*
+         * Disable sending mtime back to the client. If the client locked the
+         * whole object, then it has already updated the mtime on its side,
+         * otherwise it will have to glimpse anyway (see bug 21489, comment 32)
+         */
+        repbody->oa.o_valid &= ~(OBD_MD_FLMTIME | OBD_MD_FLATIME);
+
         if (unlikely(client_cksum != server_cksum && rc == 0)) {
                 int  new_cksum = ost_checksum_bulk(desc, OST_WRITE, cksum_type);
                 char *msg;
@@ -1199,6 +1205,14 @@ out_bulk:
         if (desc)
                 ptlrpc_free_bulk(desc);
 out:
+       /* XXX: don't send reply if obd rdonly mode, this can cause data loss
+        * on client, see bug 22190. Remove this when async bulk will be done.
+        * Meanwhile, if this is umount then don't reply anything. */
+        if (req->rq_export->exp_obd->obd_no_transno) {
+                no_reply = req->rq_export->exp_obd->obd_stopping;
+                rc = -EIO;
+        }
+
         if (rc == 0) {
                 oti_to_request(oti, req);
                 target_committed_to_req(req);
@@ -1898,7 +1912,12 @@ static int ost_hpreq_handler(struct ptlrpc_request *req)
                          * it doesn't change).
                          */
                         req_capsule_init(&req->rq_pill, req, RCL_SERVER);
-                        req_capsule_set(&req->rq_pill, &RQF_OST_BRW);
+                        if (opc == OST_READ)
+                                req_capsule_set(&req->rq_pill,
+                                                &RQF_OST_BRW_READ);
+                        else
+                                req_capsule_set(&req->rq_pill,
+                                                &RQF_OST_BRW_WRITE);
 
                         body = req_capsule_client_get(&req->rq_pill,
                                                       &RMF_OST_BODY);
@@ -1990,8 +2009,6 @@ int ost_handle(struct ptlrpc_request *req)
         req_capsule_init(&req->rq_pill, req, RCL_SERVER);
 
         if (lustre_msg_get_opc(req->rq_reqmsg) != OST_CONNECT) {
-                int recovering;
-
                 if (!class_connected_export(req->rq_export)) {
                         CDEBUG(D_HA,"operation %d on unconnected OST from %s\n",
                                lustre_msg_get_opc(req->rq_reqmsg),
@@ -2003,10 +2020,7 @@ int ost_handle(struct ptlrpc_request *req)
                 obd = req->rq_export->exp_obd;
 
                 /* Check for aborted recovery. */
-                cfs_spin_lock_bh(&obd->obd_processing_task_lock);
-                recovering = obd->obd_recovering;
-                cfs_spin_unlock_bh(&obd->obd_processing_task_lock);
-                if (recovering) {
+                if (obd->obd_recovering) {
                         rc = ost_filter_recovery_request(req, obd,
                                                          &should_process);
                         if (rc || !should_process)
@@ -2081,7 +2095,7 @@ int ost_handle(struct ptlrpc_request *req)
                 rc = ost_setattr(req->rq_export, req, oti);
                 break;
         case OST_WRITE:
-                req_capsule_set(&req->rq_pill, &RQF_OST_BRW);
+                req_capsule_set(&req->rq_pill, &RQF_OST_BRW_WRITE);
                 CDEBUG(D_INODE, "write\n");
                 /* req->rq_request_portal would be nice, if it was set */
                 if (req->rq_rqbd->rqbd_service->srv_req_portal !=OST_IO_PORTAL){
@@ -2102,7 +2116,7 @@ int ost_handle(struct ptlrpc_request *req)
                 /* ost_brw_write sends its own replies */
                 RETURN(rc);
         case OST_READ:
-                req_capsule_set(&req->rq_pill, &RQF_OST_BRW);
+                req_capsule_set(&req->rq_pill, &RQF_OST_BRW_READ);
                 CDEBUG(D_INODE, "read\n");
                 /* req->rq_request_portal would be nice, if it was set */
                 if (req->rq_rqbd->rqbd_service->srv_req_portal !=OST_IO_PORTAL){