From 267dcd4bfcf9bdb25e59e6d0ecc6e7a4d693a4e8 Mon Sep 17 00:00:00 2001 From: alex Date: Sat, 1 Nov 2003 11:48:07 +0000 Subject: [PATCH] - filter_finish_transno() moved in filter_direct_io() - fsfilt_commit_async() is called unconditionally in filter_direct_io() --- lustre/obdfilter/filter_io_24.c | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/lustre/obdfilter/filter_io_24.c b/lustre/obdfilter/filter_io_24.c index ffb7603..c337777 100644 --- a/lustre/obdfilter/filter_io_24.c +++ b/lustre/obdfilter/filter_io_24.c @@ -57,13 +57,15 @@ int ext3_map_inode_page(struct inode *inode, struct page *page, unsigned long *blocks, int *created, int create); /* Must be called with i_sem taken; this will drop it */ static int filter_direct_io(int rw, struct inode *inode, struct kiobuf *iobuf, - struct obd_device *obd, struct obd_trans_info *oti, + struct obd_export *exp, struct obd_trans_info *oti, void **wait_handle) { + struct obd_device *obd = exp->exp_obd; struct page *page; unsigned long *b = iobuf->blocks; int rc, i, create = (rw == OBD_BRW_WRITE), blocks_per_page; int *cr, cleanup_phase = 0, *created = NULL; + int committed = 0; ENTRY; blocks_per_page = PAGE_SIZE >> inode->i_blkbits; @@ -93,7 +95,12 @@ static int filter_direct_io(int rw, struct inode *inode, struct kiobuf *iobuf, up(&inode->i_sem); cleanup_phase = 3; + rc = filter_finish_transno(exp, oti, 0); + if (rc) + GOTO(cleanup, rc); + rc = fsfilt_commit_async(obd, inode, oti->oti_handle, wait_handle); + committed = 1; if (rc) GOTO(cleanup, rc); @@ -110,6 +117,17 @@ static int filter_direct_io(int rw, struct inode *inode, struct kiobuf *iobuf, EXIT; cleanup: + if (!committed) { + int err = fsfilt_commit_async(obd, inode, + oti->oti_handle, wait_handle); + if (err) + CERROR("can't close transaction: %d\n", err); + /* + * this is error path, so we prefer to return + * original error, not this one + */ + } + switch(cleanup_phase) { case 3: case 2: @@ -197,7 +215,7 @@ int filter_commitrw_write(struct obd_export *exp, int objcount, if (time_after(jiffies, now + 15 * HZ)) CERROR("slow brw_start %lus\n", (jiffies - now) / HZ); - rc = filter_direct_io(OBD_BRW_WRITE, inode, iobuf, obd, + rc = filter_direct_io(OBD_BRW_WRITE, inode, iobuf, exp, oti, &wait_handle); if (rc == 0) { lock_kernel(); @@ -214,7 +232,6 @@ int filter_commitrw_write(struct obd_export *exp, int objcount, if (time_after(jiffies, now + 15 * HZ)) CERROR("slow direct_io %lus\n", (jiffies - now) / HZ); - rc = filter_finish_transno(exp, oti, rc); err = fsfilt_commit_wait(obd, inode, wait_handle); if (err) rc = err; -- 1.8.3.1