From: nasf Date: Wed, 2 Mar 2011 10:23:08 +0000 (+0800) Subject: b=22703 no error when close if application has known write failure already X-Git-Tag: 2.0.59-llnl2-base~7 X-Git-Url: https://git.whamcloud.com/?p=fs%2Flustre-release.git;a=commitdiff_plain;h=b9e339b6aebde2d3dd5c6250aed6ec5d4fa5797f;ds=sidebyside b=22703 no error when close if application has known write failure already Do not return error when close if application has known write failure already. Issues: LU-65 Change-Id: I25b9628fcdd3bf5b7db9d3f8460e06c18226b2e0 Signed-off-by: nasf Reviewed-on: http://review.whamcloud.com/286 Tested-by: Hudson Reviewed-by: Jinshan Xiong Reviewed-by: Oleg Drokin --- diff --git a/lustre/llite/file.c b/lustre/llite/file.c index d2c7bb2..957694b 100644 --- a/lustre/llite/file.c +++ b/lustre/llite/file.c @@ -830,8 +830,9 @@ static ssize_t ll_file_io_generic(const struct lu_env *env, struct vvp_io_args *args, struct file *file, enum cl_io_type iot, loff_t *ppos, size_t count) { - struct cl_io *io; - ssize_t result; + struct ll_inode_info *lli = ll_i2info(file->f_dentry->d_inode); + struct cl_io *io; + ssize_t result; ENTRY; io = &ccc_env_info(env)->cti_io; @@ -840,7 +841,6 @@ static ssize_t ll_file_io_generic(const struct lu_env *env, if (cl_io_rw_init(env, io, iot, *ppos, count) == 0) { struct vvp_io *vio = vvp_env_io(env); struct ccc_io *cio = ccc_env_io(env); - struct ll_inode_info *lli = ll_i2info(file->f_dentry->d_inode); int write_sem_locked = 0; cio->cui_fd = LUSTRE_FPRIVATE(file); @@ -892,6 +892,8 @@ static ssize_t ll_file_io_generic(const struct lu_env *env, GOTO(out, result); out: cl_io_fini(env, io); + if (iot == CIT_WRITE) + lli->lli_write_rc = result < 0 ? : 0; return result; } @@ -1892,6 +1894,10 @@ int ll_flush(struct file *file) struct lov_stripe_md *lsm = lli->lli_smd; int rc, err; + /* the application should know write failure already. */ + if (lli->lli_write_rc) + return 0; + /* catch async errors that were recorded back when async writeback * failed for pages in this mapping. */ rc = lli->lli_async_rc; @@ -1965,6 +1971,7 @@ int ll_fsync(struct file *file, struct dentry *dentry, int data) if (!rc) rc = err; OBDO_FREE(oa); + lli->lli_write_rc = err < 0 ? : 0; } RETURN(rc); diff --git a/lustre/llite/llite_internal.h b/lustre/llite/llite_internal.h index 0e010ba..f9b8691 100644 --- a/lustre/llite/llite_internal.h +++ b/lustre/llite/llite_internal.h @@ -138,6 +138,7 @@ struct ll_inode_info { /* for writepage() only to communicate to fsync */ int lli_async_rc; + int lli_write_rc; struct posix_acl *lli_posix_acl;