From: anserper Date: Thu, 30 Jul 2009 16:52:49 +0000 (+0000) Subject: b=20142 X-Git-Tag: v1_9_230~9 X-Git-Url: https://git.whamcloud.com/gitweb?a=commitdiff_plain;h=457731e551a538b6e26fb30ca85e8f0405fd0b12;p=fs%2Flustre-release.git b=20142 i=Oleg Drokin i=Johann Lombardi remove racy i_size_reads from filter_preprw_read; those could lead to certain inconsistencies during page preparations, assertions in ost_brw_read following them --- diff --git a/lustre/obdfilter/filter_io.c b/lustre/obdfilter/filter_io.c index ea2721e..e6d289a 100644 --- a/lustre/obdfilter/filter_io.c +++ b/lustre/obdfilter/filter_io.c @@ -410,6 +410,7 @@ static int filter_preprw_read(int cmd, struct obd_export *exp, struct obdo *oa, int rc = 0, i, tot_bytes = 0; unsigned long now = jiffies; long timediff; + loff_t isize; ENTRY; /* We are currently not supporting multi-obj BRW_READ RPCS at all. @@ -445,6 +446,7 @@ static int filter_preprw_read(int cmd, struct obd_export *exp, struct obdo *oa, } inode = dentry->d_inode; + isize = i_size_read(inode); obdo_to_inode(inode, oa, OBD_MD_FLATIME); @@ -460,7 +462,7 @@ static int filter_preprw_read(int cmd, struct obd_export *exp, struct obdo *oa, lnb->dentry = dentry; - if (i_size_read(inode) <= lnb->offset) + if (isize <= lnb->offset) /* If there's no more data, abort early. lnb->rc == 0, * so it's easy to detect later. */ break; @@ -471,8 +473,8 @@ static int filter_preprw_read(int cmd, struct obd_export *exp, struct obdo *oa, lprocfs_counter_add(obd->obd_stats, LPROC_FILTER_CACHE_ACCESS, 1); - if (i_size_read(inode) < lnb->offset + lnb->len - 1) - lnb->rc = i_size_read(inode) - lnb->offset; + if (isize < lnb->offset + lnb->len - 1) + lnb->rc = isize - lnb->offset; else lnb->rc = lnb->len;