Whamcloud - gitweb
Branch b_release_1_8_1
authortianzy <tianzy>
Tue, 19 May 2009 07:46:41 +0000 (07:46 +0000)
committertianzy <tianzy>
Tue, 19 May 2009 07:46:41 +0000 (07:46 +0000)
fix the problem of "if fsfilt_add_journal_cb() will fail,
export ref will be took twice."
b=19321
i=tappro
i=tianzy

lustre/mds/mds_reint.c
lustre/obdfilter/filter.c

index d347a7c..cb47f81 100644 (file)
@@ -320,16 +320,17 @@ int mds_finish_transno(struct mds_obd *mds, struct inode **inodes, void *handle,
         } else {
                 struct obd_export *exp = req->rq_export;
 
+                class_export_get(exp); /* released once the cb is called */
                 if (!force_sync)
                         force_sync = fsfilt_add_journal_cb(obd, transno,
                                                            handle, mds_commit_cb,
-                                                           class_export_get(exp));
+                                                           exp);
 
                 err = fsfilt_write_record(obd, mds->mds_rcvd_filp, lcd,
                                           sizeof(*lcd), &off,
                                           force_sync | exp->exp_need_sync);
                 if (force_sync)
-                        mds_commit_cb(obd, transno, class_export_get(exp), err);
+                        mds_commit_cb(obd, transno, exp, err);
         }
 
         if (err) {
index 7f3c679..91d24a6 100644 (file)
@@ -166,18 +166,19 @@ int filter_finish_transno(struct obd_export *exp, struct inode *inode,
                        fed->fed_lr_idx, fed->fed_lr_off);
                 err = -EINVAL;
         } else {
+                class_export_get(exp); /* released when the cb is called */
                 if (!force_sync)
                         force_sync = fsfilt_add_journal_cb(exp->exp_obd,
                                                            last_rcvd,
                                                            oti->oti_handle,
                                                            filter_commit_cb,
-                                                           class_export_get(exp));
+                                                           exp);
 
                 err = fsfilt_write_record(exp->exp_obd, filter->fo_rcvd_filp,
                                           lcd, sizeof(*lcd), &off,
                                           force_sync | exp->exp_need_sync);
                 if (force_sync)
-                        filter_commit_cb(exp->exp_obd, last_rcvd, class_export_get(exp), err);
+                        filter_commit_cb(exp->exp_obd, last_rcvd, exp, err);
         }
         if (err) {
                 log_pri = D_ERROR;