From: adilger Date: Thu, 15 Aug 2002 16:56:03 +0000 (+0000) Subject: Don't change local inode size if we had a write error (that causes vmtruncate X-Git-Tag: 0.5.5~146 X-Git-Url: https://git.whamcloud.com/?a=commitdiff_plain;h=f28523800788a75b9aebadc03f4002526cb5d8a0;p=fs%2Flustre-release.git Don't change local inode size if we had a write error (that causes vmtruncate to try and truncate the file, which calls osc_punch() to remove blocks we didn't write in the first place). --- diff --git a/lustre/llite/rw.c b/lustre/llite/rw.c index 58cdf10..924c1f3 100644 --- a/lustre/llite/rw.c +++ b/lustre/llite/rw.c @@ -155,9 +155,9 @@ static int ll_commit_write(struct file *file, struct page *page, struct inode *inode = page->mapping->host; struct ll_inode_info *lii = ll_i2info(inode); struct lov_stripe_md *md = lii->lli_smd; - struct brw_page pg; - int err; - struct iattr iattr; + struct brw_page pg; + int err; + struct iattr iattr; struct io_cb_data *cbd = ll_init_cb(); pg.pg = page; @@ -166,8 +166,8 @@ static int ll_commit_write(struct file *file, struct page *page, pg.flag = create ? OBD_BRW_CREATE : 0; ENTRY; - if (!cbd) - RETURN(-ENOMEM); + if (!cbd) + RETURN(-ENOMEM); SetPageUptodate(page); @@ -181,6 +181,9 @@ static int ll_commit_write(struct file *file, struct page *page, 1, &pg, ll_sync_io_cb, cbd); kunmap(page); + if (err) + GOTO(out, err); + iattr.ia_size = pg.off + pg.count; if (iattr.ia_size > inode->i_size) { /* do NOT truncate when writing in the middle of a file */ @@ -194,7 +197,7 @@ static int ll_commit_write(struct file *file, struct page *page, } #endif } - +out: RETURN(err); } /* ll_commit_write */