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;
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);
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:
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();
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;