summaryrefslogtreecommitdiffstats
path: root/sys/fs/tmpfs/tmpfs_subr.c
diff options
context:
space:
mode:
authoralc <alc@FreeBSD.org>2012-01-16 00:26:49 +0000
committeralc <alc@FreeBSD.org>2012-01-16 00:26:49 +0000
commit213db2103e6330ef8205522e5abb4dc9481c6c3d (patch)
treeead83f2a8c9c0d57d631896299abc8a488aa7e10 /sys/fs/tmpfs/tmpfs_subr.c
parent83920bc18511f0c34df0d3888ba7ebe90c39d3d8 (diff)
downloadFreeBSD-src-213db2103e6330ef8205522e5abb4dc9481c6c3d.zip
FreeBSD-src-213db2103e6330ef8205522e5abb4dc9481c6c3d.tar.gz
When tmpfs_write() resets an extended file to its original size after an
error, we want tmpfs_reg_resize() to ignore I/O errors and unconditionally update the file's size. Reviewed by: kib MFC after: 3 weeks
Diffstat (limited to 'sys/fs/tmpfs/tmpfs_subr.c')
-rw-r--r--sys/fs/tmpfs/tmpfs_subr.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/sys/fs/tmpfs/tmpfs_subr.c b/sys/fs/tmpfs/tmpfs_subr.c
index 94bc0bf..d2b2245 100644
--- a/sys/fs/tmpfs/tmpfs_subr.c
+++ b/sys/fs/tmpfs/tmpfs_subr.c
@@ -882,7 +882,7 @@ tmpfs_dir_whiteout_remove(struct vnode *dvp, struct componentname *cnp)
* Returns zero on success or an appropriate error code on failure.
*/
int
-tmpfs_reg_resize(struct vnode *vp, off_t newsize)
+tmpfs_reg_resize(struct vnode *vp, off_t newsize, boolean_t ignerr)
{
struct tmpfs_mount *tmp;
struct tmpfs_node *node;
@@ -952,8 +952,12 @@ retry:
} else {
vm_page_free(m);
vm_page_unlock(m);
- VM_OBJECT_UNLOCK(uobj);
- return (EIO);
+ if (ignerr)
+ m = NULL;
+ else {
+ VM_OBJECT_UNLOCK(uobj);
+ return (EIO);
+ }
}
}
if (m != NULL) {
@@ -1351,7 +1355,7 @@ tmpfs_truncate(struct vnode *vp, off_t length)
if (length > VFS_TO_TMPFS(vp->v_mount)->tm_maxfilesize)
return (EFBIG);
- error = tmpfs_reg_resize(vp, length);
+ error = tmpfs_reg_resize(vp, length, FALSE);
if (error == 0) {
node->tn_status |= TMPFS_NODE_CHANGED | TMPFS_NODE_MODIFIED;
}
OpenPOWER on IntegriCloud