Whamcloud - gitweb
LU-9224 fid: race between client_fid_fini and seq_client_flush
[fs/lustre-release.git] / lustre / mdc / mdc_request.c
index 2426ce8..2c45545 100644 (file)
@@ -2516,8 +2516,10 @@ static int mdc_import_event(struct obd_device *obd, struct obd_import *imp,
                 * Flush current sequence to make client obtain new one
                 * from server in case of disconnect/reconnect.
                 */
-               if (cli->cl_seq != NULL)
+               down_read(&cli->cl_seq_rwsem);
+               if (cli->cl_seq)
                        seq_client_flush(cli->cl_seq);
+               up_read(&cli->cl_seq_rwsem);
 
                rc = obd_notify_observer(obd, obd, OBD_NOTIFY_INACTIVE);
                break;
@@ -2553,9 +2555,16 @@ int mdc_fid_alloc(const struct lu_env *env, struct obd_export *exp,
                  struct lu_fid *fid, struct md_op_data *op_data)
 {
        struct client_obd *cli = &exp->exp_obd->u.cli;
-       struct lu_client_seq *seq = cli->cl_seq;
+       int rc = -EIO;
+
        ENTRY;
-       RETURN(seq_client_alloc_fid(env, seq, fid));
+
+       down_read(&cli->cl_seq_rwsem);
+       if (cli->cl_seq)
+               rc = seq_client_alloc_fid(env, cli->cl_seq, fid);
+       up_read(&cli->cl_seq_rwsem);
+
+       RETURN(rc);
 }
 
 static struct obd_uuid *mdc_get_uuid(struct obd_export *exp)