Skip to content

Commit

Permalink
To re-run quota check when EFAULT in zfs_write
Browse files Browse the repository at this point in the history
Signed-off-by: Grady Wong <[email protected]>
  • Loading branch information
Grady Wong committed Oct 5, 2018
1 parent 4530de4 commit 1dcdf88
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 14 deletions.
2 changes: 1 addition & 1 deletion include/sys/dmu.h
Original file line number Diff line number Diff line change
Expand Up @@ -846,7 +846,7 @@ int dmu_write_uio(objset_t *os, uint64_t object, struct uio *uio, uint64_t size,
int dmu_write_uio_dbuf(dmu_buf_t *zdb, struct uio *uio, uint64_t size,
dmu_tx_t *tx);
int dmu_write_uio_dnode(dnode_t *dn, struct uio *uio, uint64_t size,
dmu_tx_t *tx, boolean_t fault_disable);
dmu_tx_t *tx);
#endif
struct arc_buf *dmu_request_arcbuf(dmu_buf_t *handle, int size);
void dmu_return_arcbuf(struct arc_buf *buf);
Expand Down
7 changes: 3 additions & 4 deletions module/zfs/dmu.c
Original file line number Diff line number Diff line change
Expand Up @@ -1488,8 +1488,7 @@ dmu_read_uio(objset_t *os, uint64_t object, uio_t *uio, uint64_t size)
}

int
dmu_write_uio_dnode(dnode_t *dn, uio_t *uio, uint64_t size, dmu_tx_t *tx,
boolean_t fault_disable)
dmu_write_uio_dnode(dnode_t *dn, uio_t *uio, uint64_t size, dmu_tx_t *tx)
{
dmu_buf_t **dbp;
int numbufs;
Expand Down Expand Up @@ -1562,7 +1561,7 @@ dmu_write_uio_dbuf(dmu_buf_t *zdb, uio_t *uio, uint64_t size,

DB_DNODE_ENTER(db);
dn = DB_DNODE(db);
err = dmu_write_uio_dnode(dn, uio, size, tx, B_TRUE);
err = dmu_write_uio_dnode(dn, uio, size, tx);
DB_DNODE_EXIT(db);

return (err);
Expand All @@ -1587,7 +1586,7 @@ dmu_write_uio(objset_t *os, uint64_t object, uio_t *uio, uint64_t size,
if (err)
return (err);

err = dmu_write_uio_dnode(dn, uio, size, tx, B_FALSE);
err = dmu_write_uio_dnode(dn, uio, size, tx);

dnode_rele(dn, FTAG);

Expand Down
1 change: 0 additions & 1 deletion module/zfs/dmu_tx.c
Original file line number Diff line number Diff line change
Expand Up @@ -1040,7 +1040,6 @@ dmu_tx_assign(dmu_tx_t *tx, uint64_t txg_how)
return (0);
}


void
dmu_tx_wait(dmu_tx_t *tx)
{
Expand Down
4 changes: 2 additions & 2 deletions module/zfs/zfs_sa.c
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,8 @@ zfs_sa_readlink(znode_t *zp, uio_t *uio)
dmu_buf_t *dbp;
if ((error = dmu_buf_hold(ZTOZSB(zp)->z_os, zp->z_id,
0, FTAG, &dbp, DMU_READ_NO_PREFETCH)) == 0) {
error = uiomove(dbp->db_data, MIN((size_t)bufsz,
uio->uio_resid), UIO_READ, uio);
error = uiomove(dbp->db_data,
MIN((size_t)bufsz, uio->uio_resid), UIO_READ, uio);
dmu_buf_rele(dbp, FTAG);
}
}
Expand Down
7 changes: 3 additions & 4 deletions module/zfs/zfs_vnops.c
Original file line number Diff line number Diff line change
Expand Up @@ -763,9 +763,7 @@ zfs_write(struct inode *ip, uio_t *uio, int ioflag, cred_t *cr)
/*
* Start a transaction.
*/
dmu_tx_t *tx = NULL;
top:
tx = dmu_tx_create(zfsvfs->z_os);
dmu_tx_t *tx = dmu_tx_create(zfsvfs->z_os);
dmu_tx_hold_sa(tx, zp->z_sa_hdl, B_FALSE);
dmu_tx_hold_write(tx, zp->z_id, woff, MIN(n, max_blksz));
zfs_sa_upgrade_txholds(tx, zp);
Expand Down Expand Up @@ -811,12 +809,13 @@ zfs_write(struct inode *ip, uio_t *uio, int ioflag, cred_t *cr)
ssize_t tx_bytes;
if (abuf == NULL) {
tx_bytes = uio->uio_resid;
uio->uio_fault_disable = B_TRUE;
error = dmu_write_uio_dbuf(sa_get_db(zp->z_sa_hdl),
uio, nbytes, tx);
if (error == EFAULT) {
uio_prefaultpages(MIN(n, max_blksz), uio);
dmu_tx_commit(tx);
goto top;
continue;
} else if (error != 0) {
dmu_tx_abort(tx);
break;
Expand Down
3 changes: 1 addition & 2 deletions module/zfs/zvol.c
Original file line number Diff line number Diff line change
Expand Up @@ -769,8 +769,7 @@ zvol_write(void *arg)
dmu_tx_abort(tx);
break;
}
error = dmu_write_uio_dnode(zv->zv_dn, &uio, bytes, tx,
B_FALSE);
error = dmu_write_uio_dnode(zv->zv_dn, &uio, bytes, tx);
if (error == 0) {
zvol_log_write(zv, tx, off, bytes, sync);
}
Expand Down

0 comments on commit 1dcdf88

Please sign in to comment.