mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-04-14 02:14:35 +00:00
nfs: defer inode_dio_done call until size update is done
We need to have the I/O fully finished before telling the truncate code that we are done. Signed-off-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
This commit is contained in:
parent
9811cd57f4
commit
2a009ec98c
1 changed files with 15 additions and 17 deletions
|
@ -226,21 +226,27 @@ static void nfs_direct_complete(struct nfs_direct_req *dreq, bool write)
|
||||||
{
|
{
|
||||||
struct inode *inode = dreq->inode;
|
struct inode *inode = dreq->inode;
|
||||||
|
|
||||||
if (dreq->iocb) {
|
if (dreq->iocb && write) {
|
||||||
loff_t pos = dreq->iocb->ki_pos + dreq->count;
|
loff_t pos = dreq->iocb->ki_pos + dreq->count;
|
||||||
long res = (long) dreq->error;
|
|
||||||
if (!res)
|
|
||||||
res = (long) dreq->count;
|
|
||||||
|
|
||||||
if (write) {
|
|
||||||
spin_lock(&inode->i_lock);
|
spin_lock(&inode->i_lock);
|
||||||
if (i_size_read(inode) < pos)
|
if (i_size_read(inode) < pos)
|
||||||
i_size_write(inode, pos);
|
i_size_write(inode, pos);
|
||||||
spin_unlock(&inode->i_lock);
|
spin_unlock(&inode->i_lock);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (write) {
|
||||||
|
nfs_zap_mapping(inode, inode->i_mapping);
|
||||||
|
inode_dio_done(inode);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (dreq->iocb) {
|
||||||
|
long res = (long) dreq->error;
|
||||||
|
if (!res)
|
||||||
|
res = (long) dreq->count;
|
||||||
aio_complete(dreq->iocb, res, 0);
|
aio_complete(dreq->iocb, res, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
complete_all(&dreq->completion);
|
complete_all(&dreq->completion);
|
||||||
|
|
||||||
nfs_direct_req_release(dreq);
|
nfs_direct_req_release(dreq);
|
||||||
|
@ -483,12 +489,6 @@ out:
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void nfs_inode_dio_write_done(struct inode *inode)
|
|
||||||
{
|
|
||||||
nfs_zap_mapping(inode, inode->i_mapping);
|
|
||||||
inode_dio_done(inode);
|
|
||||||
}
|
|
||||||
|
|
||||||
#if IS_ENABLED(CONFIG_NFS_V3) || IS_ENABLED(CONFIG_NFS_V4)
|
#if IS_ENABLED(CONFIG_NFS_V3) || IS_ENABLED(CONFIG_NFS_V4)
|
||||||
static void nfs_direct_write_reschedule(struct nfs_direct_req *dreq)
|
static void nfs_direct_write_reschedule(struct nfs_direct_req *dreq)
|
||||||
{
|
{
|
||||||
|
@ -604,7 +604,6 @@ static void nfs_direct_write_schedule_work(struct work_struct *work)
|
||||||
nfs_direct_write_reschedule(dreq);
|
nfs_direct_write_reschedule(dreq);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
nfs_inode_dio_write_done(dreq->inode);
|
|
||||||
nfs_direct_complete(dreq, true);
|
nfs_direct_complete(dreq, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -621,7 +620,6 @@ static void nfs_direct_write_schedule_work(struct work_struct *work)
|
||||||
|
|
||||||
static void nfs_direct_write_complete(struct nfs_direct_req *dreq, struct inode *inode)
|
static void nfs_direct_write_complete(struct nfs_direct_req *dreq, struct inode *inode)
|
||||||
{
|
{
|
||||||
nfs_inode_dio_write_done(inode);
|
|
||||||
nfs_direct_complete(dreq, true);
|
nfs_direct_complete(dreq, true);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Add table
Reference in a new issue