[PATCH] Fix and add EXPORT_SYMBOL(filemap_write_and_wait)
This patch add EXPORT_SYMBOL(filemap_write_and_wait) and use it. See mm/filemap.c: And changes the filemap_write_and_wait() and filemap_write_and_wait_range(). Current filemap_write_and_wait() doesn't wait if filemap_fdatawrite() returns error. However, even if filemap_fdatawrite() returned an error, it may have submitted the partially data pages to the device. (e.g. in the case of -ENOSPC) <quotation> Andrew Morton writes, If filemap_fdatawrite() returns an error, this might be due to some I/O problem: dead disk, unplugged cable, etc. Given the generally crappy quality of the kernel's handling of such exceptions, there's a good chance that the filemap_fdatawait() will get stuck in D state forever. </quotation> So, this patch doesn't wait if filemap_fdatawrite() returns the -EIO. Trond, could you please review the nfs part? Especially I'm not sure, nfs must use the "filemap_fdatawrite(inode->i_mapping) == 0", or not. Acked-by: Trond Myklebust <trond.myklebust@fys.uio.no> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
This commit is contained in:

committed by
Linus Torvalds

parent
05eb0b51fb
commit
28fd129827
@@ -644,10 +644,7 @@ int nfs_sync_mapping(struct address_space *mapping)
|
||||
if (mapping->nrpages == 0)
|
||||
return 0;
|
||||
unmap_mapping_range(mapping, 0, 0, 0);
|
||||
ret = filemap_fdatawrite(mapping);
|
||||
if (ret != 0)
|
||||
goto out;
|
||||
ret = filemap_fdatawait(mapping);
|
||||
ret = filemap_write_and_wait(mapping);
|
||||
if (ret != 0)
|
||||
goto out;
|
||||
ret = nfs_wb_all(mapping->host);
|
||||
@@ -864,8 +861,7 @@ nfs_setattr(struct dentry *dentry, struct iattr *attr)
|
||||
nfs_begin_data_update(inode);
|
||||
/* Write all dirty data if we're changing file permissions or size */
|
||||
if ((attr->ia_valid & (ATTR_MODE|ATTR_UID|ATTR_GID|ATTR_SIZE)) != 0) {
|
||||
if (filemap_fdatawrite(inode->i_mapping) == 0)
|
||||
filemap_fdatawait(inode->i_mapping);
|
||||
filemap_write_and_wait(inode->i_mapping);
|
||||
nfs_wb_all(inode);
|
||||
}
|
||||
/*
|
||||
|
Reference in New Issue
Block a user