From 2737cd8ce7f6ce3be6b1ba8903749fdb322e0ff6 Mon Sep 17 00:00:00 2001 From: yury Date: Tue, 1 Nov 2005 12:55:24 +0000 Subject: [PATCH] - fixes in filter_preprw_read() for case when OST object is not yet allocated. --- lustre/obdfilter/filter.c | 7 ++++--- lustre/obdfilter/filter_io.c | 31 +++++++++++++++++++------------ 2 files changed, 23 insertions(+), 15 deletions(-) diff --git a/lustre/obdfilter/filter.c b/lustre/obdfilter/filter.c index a392006..5a8bf46 100644 --- a/lustre/obdfilter/filter.c +++ b/lustre/obdfilter/filter.c @@ -1893,8 +1893,8 @@ static int filter_disconnect(struct obd_export *exp) RETURN(rc); } -struct dentry *__filter_oa2dentry(struct obd_device *obd, - struct obdo *oa, const char *what, int quiet) +struct dentry *__filter_oa2dentry(struct obd_device *obd, struct obdo *oa, + const char *what, int quiet) { struct dentry *dchild = NULL; obd_gr group = 0; @@ -1905,7 +1905,8 @@ struct dentry *__filter_oa2dentry(struct obd_device *obd, dchild = filter_fid2dentry(obd, NULL, group, oa->o_id); if (IS_ERR(dchild)) { - CERROR("%s error looking up object: "LPU64"\n", what, oa->o_id); + CERROR("%s error looking up object: "LPU64"\n", + what, oa->o_id); RETURN(dchild); } diff --git a/lustre/obdfilter/filter_io.c b/lustre/obdfilter/filter_io.c index 9326349..4448c45 100644 --- a/lustre/obdfilter/filter_io.c +++ b/lustre/obdfilter/filter_io.c @@ -297,13 +297,17 @@ static int filter_preprw_read(int cmd, struct obd_export *exp, struct obdo *oa, dentry = filter_oa2dentry(obd, oa); if (IS_ERR(dentry)) { rc = PTR_ERR(dentry); - dentry = NULL; - GOTO(cleanup, rc); + if (rc == -ENOENT) { + inode = NULL; + } else { + dentry = NULL; + GOTO(cleanup, rc); + } + } else { + inode = dentry->d_inode; } - inode = dentry->d_inode; - - if (oa) + if (oa && inode != NULL) obdo_to_inode(inode, oa, OBD_MD_FLATIME); fsfilt_check_slow(now, obd_timeout, "preprw_read setup"); @@ -322,9 +326,10 @@ static int filter_preprw_read(int cmd, struct obd_export *exp, struct obdo *oa, */ LASSERT(lnb->page != NULL); - if (inode->i_size <= rnb->offset) - /* If there's no more data, abort early. lnb->rc == 0, - * so it's easy to detect later. */ + if (inode == NULL || inode->i_size <= rnb->offset) + /* If there's no more data, or inode is not yet + * allocated by CROW abort early. lnb->rc == 0, so it's + * easy to detect later. */ break; else filter_alloc_dio_page(obd, inode, lnb); @@ -341,10 +346,12 @@ static int filter_preprw_read(int cmd, struct obd_export *exp, struct obdo *oa, fsfilt_check_slow(now, obd_timeout, "start_page_read"); - rc = filter_direct_io(OBD_BRW_READ, dentry, iobuf, exp, - NULL, NULL, NULL); - if (rc) - GOTO(cleanup, rc); + if (inode != NULL) { + rc = filter_direct_io(OBD_BRW_READ, dentry, iobuf, exp, + NULL, NULL, NULL); + if (rc) + GOTO(cleanup, rc); + } lprocfs_counter_add(obd->obd_stats, LPROC_FILTER_READ_BYTES, tot_bytes); -- 1.8.3.1