diff options
| author | akpm <akpm@linux-foundation.org> | 2022-06-27 10:31:34 -0700 |
|---|---|---|
| committer | akpm <akpm@linux-foundation.org> | 2022-06-27 10:31:34 -0700 |
| commit | 46a3b1125308f8f90a065eeecfafd2a96b01a36c (patch) | |
| tree | 6e080118fbad5aa217d160cedf02f10108ce3bf2 /fs/9p/vfs_addr.c | |
| parent | 6edda04ccc7cfb281d139e352dbd5dd933bd2751 (diff) | |
| parent | 03c765b0e3b4cb5063276b086c76f7a612856a9a (diff) | |
Merge branch 'master' into mm-stable
Diffstat (limited to 'fs/9p/vfs_addr.c')
| -rw-r--r-- | fs/9p/vfs_addr.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/fs/9p/vfs_addr.c b/fs/9p/vfs_addr.c index a8f512b44a85..d0833fa69faf 100644 --- a/fs/9p/vfs_addr.c +++ b/fs/9p/vfs_addr.c @@ -58,8 +58,21 @@ static void v9fs_issue_read(struct netfs_io_subrequest *subreq) */ static int v9fs_init_request(struct netfs_io_request *rreq, struct file *file) { + struct inode *inode = file_inode(file); + struct v9fs_inode *v9inode = V9FS_I(inode); struct p9_fid *fid = file->private_data; + BUG_ON(!fid); + + /* we might need to read from a fid that was opened write-only + * for read-modify-write of page cache, use the writeback fid + * for that */ + if (rreq->origin == NETFS_READ_FOR_WRITE && + (fid->mode & O_ACCMODE) == O_WRONLY) { + fid = v9inode->writeback_fid; + BUG_ON(!fid); + } + refcount_inc(&fid->count); rreq->netfs_priv = fid; return 0; |