Whamcloud - gitweb
branch: HEAD
authorericm <ericm>
Wed, 29 Apr 2009 03:47:57 +0000 (03:47 +0000)
committerericm <ericm>
Wed, 29 Apr 2009 03:47:57 +0000 (03:47 +0000)
fix replayed meta sequence handling.
b=18982
r=rread
r=fanyong

lustre/fid/fid_handler.c

index 4b32cda..7039302 100644 (file)
@@ -213,14 +213,12 @@ static int __seq_server_alloc_meta(struct lu_server_seq *seq,
                 CDEBUG(D_INFO, "%s: Input seq range: "
                        DRANGE"\n", seq->lss_name, PRANGE(in));
 
-                if (range_is_exhausted(space)) {
+                if (in->lsr_end <= space->lsr_start) {
                         /*
-                         * Server cannot send empty range to client, this is why
-                         * we check here that range from client is "newer" than
-                         * exhausted super.
+                         * Client is replaying a fairly old range, server
+                         * don't need to do any allocation.
                          */
-                        LASSERT(in->lsr_end > space->lsr_start);
-
+                } else if (range_is_exhausted(space)) {
                         /*
                          * Start is set to end of last allocated, because it
                          * *is* already allocated so we take that into account
@@ -258,8 +256,7 @@ static int __seq_server_alloc_meta(struct lu_server_seq *seq,
                          * Update super start by end from client's range. Super
                          * end should not be changed if range was not exhausted.
                          */
-                        if (in->lsr_end > space->lsr_start)
-                                space->lsr_start = in->lsr_end;
+                        space->lsr_start = in->lsr_end;
                 }
 
                 /* sending replay_super to update fld as only super sequence
@@ -406,7 +403,12 @@ static int seq_req_handle(struct ptlrpc_request *req,
 
                 if (lustre_msg_get_flags(req->rq_reqmsg) & MSG_REPLAY) {
                         in = tmp;
-                        LASSERT(!range_is_zero(in) && range_is_sane(in));
+
+                        if (range_is_zero(in) || !range_is_sane(in)) {
+                                CERROR("Replayed seq range is invalid: "
+                                       DRANGE"\n", PRANGE(in));
+                                RETURN(err_serious(-EINVAL));
+                        }
                 }
                 /* seq client passed mdt id, we need to pass that using out
                  * range parameter */