X-Git-Url: https://git.whamcloud.com/?p=fs%2Flustre-release.git;a=blobdiff_plain;f=lustre%2Fllite%2Ffile.c;h=7cb52328d8b0060541d23fb66e747a2b4f2f786c;hp=447195d989006732f73a946c08c634504d9744a9;hb=8fcf474eb1b6508b00ef1121d2ae5018d76d31c2;hpb=0f51e6447dfcf6ac8c2b0530cd030fb89fe73bbf diff --git a/lustre/llite/file.c b/lustre/llite/file.c index 447195d..7cb5232 100644 --- a/lustre/llite/file.c +++ b/lustre/llite/file.c @@ -1874,6 +1874,30 @@ loff_t ll_file_seek(struct file *file, loff_t offset, int origin) RETURN(retval); } +#ifdef HAVE_FLUSH_OWNER_ID +int ll_flush(struct file *file, fl_owner_t id) +#else +int ll_flush(struct file *file) +#endif +{ + struct inode *inode = file->f_dentry->d_inode; + struct ll_inode_info *lli = ll_i2info(inode); + struct lov_stripe_md *lsm = lli->lli_smd; + int rc, err; + + /* catch async errors that were recorded back when async writeback + * failed for pages in this mapping. */ + rc = lli->lli_async_rc; + lli->lli_async_rc = 0; + if (lsm) { + err = lov_test_and_clear_async_rc(lsm); + if (rc == 0) + rc = err; + } + + return rc ? -EIO : 0; +} + int ll_fsync(struct file *file, struct dentry *dentry, int data) { struct inode *inode = dentry->d_inode; @@ -2461,6 +2485,7 @@ struct file_operations ll_file_operations = { .splice_read = ll_file_splice_read, #endif .fsync = ll_fsync, + .flush = ll_flush }; struct file_operations ll_file_operations_flock = { @@ -2480,6 +2505,7 @@ struct file_operations ll_file_operations_flock = { .splice_read = ll_file_splice_read, #endif .fsync = ll_fsync, + .flush = ll_flush, #ifdef HAVE_F_OP_FLOCK .flock = ll_file_flock, #endif @@ -2504,6 +2530,7 @@ struct file_operations ll_file_operations_noflock = { .splice_read = ll_file_splice_read, #endif .fsync = ll_fsync, + .flush = ll_flush, #ifdef HAVE_F_OP_FLOCK .flock = ll_file_noflock, #endif