Whamcloud - gitweb
b=22853 client should flush current sequence to make client obtain new one from serve...
authorFan Yong <Yong.Fan@Sun.COM>
Wed, 16 Jun 2010 14:01:15 +0000 (22:01 +0800)
committerJohann Lombardi <johann@sun.com>
Thu, 17 Jun 2010 08:45:38 +0000 (10:45 +0200)
Client should flush current sequence to make client obtain new one from server in case of disconnect/reconnect.

i=robert.read
i=johann

lustre/mdc/mdc_fid.c
lustre/mdc/mdc_internal.h
lustre/mdc/mdc_request.c

index ac3379c..322760f 100644 (file)
@@ -224,11 +224,16 @@ static int seq_client_alloc_fid(struct lu_client_seq *seq, struct lu_fid *fid)
  * Finish the current sequence due to disconnect.
  * See mdc_import_event()
  */
-static void seq_client_flush(struct lu_client_seq *seq)
+void seq_client_flush(struct lu_client_seq *seq)
 {
         LASSERT(seq != NULL);
         down(&seq->lcs_sem);
         fid_init(&seq->lcs_fid);
+        /**
+         * this id shld not be used for seq range allocation.
+         * set to -1 for dgb check.
+         */
+        seq->lcs_space.lsr_mdt = -1;
         range_init(&seq->lcs_space);
         up(&seq->lcs_sem);
 }
index 7d39a04..233196b 100644 (file)
@@ -91,6 +91,8 @@ void seq_client_fini(struct lu_client_seq *seq);
 
 int mdc_fid_alloc(struct lu_client_seq *seq, struct lu_fid *fid);
 
+void seq_client_flush(struct lu_client_seq *seq);
+
 struct mdc_open_data {
         struct obd_client_handle *mod_och;
         struct ptlrpc_request    *mod_open_req;
index 095079c..9d4d0f4 100644 (file)
@@ -1331,6 +1331,14 @@ static int mdc_import_event(struct obd_device *obd, struct obd_import *imp,
                 break;
         }
         case IMP_EVENT_INACTIVE: {
+                struct client_obd *cli = &obd->u.cli;
+                /* Flush current sequence to make client obtain new one
+                 * from server in case of disconnect/reconnect.
+                 * If range is already empty then no need to flush it. */
+                if (cli->cl_seq != NULL &&
+                    !range_is_exhausted(&cli->cl_seq->lcs_space))
+                        seq_client_flush(cli->cl_seq);
+
                 rc = obd_notify_observer(obd, obd, OBD_NOTIFY_INACTIVE, NULL);
                 break;
         }