Commit 2bfc37cd authored by Linus Torvalds's avatar Linus Torvalds

Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mszeredi/fuse

Pull fuse fixes from Miklos Szeredi:
 "Fix a few bugs in fuse"

* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mszeredi/fuse:
  fuse: set mapping error in writepage_locked when it fails
  fuse: Dont call set_page_dirty_lock() for ITER_BVEC pages for async_dio
  fuse: initialize the flock flag in fuse_file on allocation
parents 7d7a827b 9183976e
...@@ -46,7 +46,7 @@ struct fuse_file *fuse_file_alloc(struct fuse_conn *fc) ...@@ -46,7 +46,7 @@ struct fuse_file *fuse_file_alloc(struct fuse_conn *fc)
{ {
struct fuse_file *ff; struct fuse_file *ff;
ff = kmalloc(sizeof(struct fuse_file), GFP_KERNEL); ff = kzalloc(sizeof(struct fuse_file), GFP_KERNEL);
if (unlikely(!ff)) if (unlikely(!ff))
return NULL; return NULL;
...@@ -609,7 +609,7 @@ static void fuse_aio_complete_req(struct fuse_conn *fc, struct fuse_req *req) ...@@ -609,7 +609,7 @@ static void fuse_aio_complete_req(struct fuse_conn *fc, struct fuse_req *req)
struct fuse_io_priv *io = req->io; struct fuse_io_priv *io = req->io;
ssize_t pos = -1; ssize_t pos = -1;
fuse_release_user_pages(req, !io->write); fuse_release_user_pages(req, io->should_dirty);
if (io->write) { if (io->write) {
if (req->misc.write.in.size != req->misc.write.out.size) if (req->misc.write.in.size != req->misc.write.out.size)
...@@ -1316,7 +1316,6 @@ ssize_t fuse_direct_io(struct fuse_io_priv *io, struct iov_iter *iter, ...@@ -1316,7 +1316,6 @@ ssize_t fuse_direct_io(struct fuse_io_priv *io, struct iov_iter *iter,
loff_t *ppos, int flags) loff_t *ppos, int flags)
{ {
int write = flags & FUSE_DIO_WRITE; int write = flags & FUSE_DIO_WRITE;
bool should_dirty = !write && iter_is_iovec(iter);
int cuse = flags & FUSE_DIO_CUSE; int cuse = flags & FUSE_DIO_CUSE;
struct file *file = io->file; struct file *file = io->file;
struct inode *inode = file->f_mapping->host; struct inode *inode = file->f_mapping->host;
...@@ -1346,6 +1345,7 @@ ssize_t fuse_direct_io(struct fuse_io_priv *io, struct iov_iter *iter, ...@@ -1346,6 +1345,7 @@ ssize_t fuse_direct_io(struct fuse_io_priv *io, struct iov_iter *iter,
inode_unlock(inode); inode_unlock(inode);
} }
io->should_dirty = !write && iter_is_iovec(iter);
while (count) { while (count) {
size_t nres; size_t nres;
fl_owner_t owner = current->files; fl_owner_t owner = current->files;
...@@ -1360,7 +1360,7 @@ ssize_t fuse_direct_io(struct fuse_io_priv *io, struct iov_iter *iter, ...@@ -1360,7 +1360,7 @@ ssize_t fuse_direct_io(struct fuse_io_priv *io, struct iov_iter *iter,
nres = fuse_send_read(req, io, pos, nbytes, owner); nres = fuse_send_read(req, io, pos, nbytes, owner);
if (!io->async) if (!io->async)
fuse_release_user_pages(req, should_dirty); fuse_release_user_pages(req, io->should_dirty);
if (req->out.h.error) { if (req->out.h.error) {
err = req->out.h.error; err = req->out.h.error;
break; break;
...@@ -1669,6 +1669,7 @@ static int fuse_writepage_locked(struct page *page) ...@@ -1669,6 +1669,7 @@ static int fuse_writepage_locked(struct page *page)
err_free: err_free:
fuse_request_free(req); fuse_request_free(req);
err: err:
mapping_set_error(page->mapping, error);
end_page_writeback(page); end_page_writeback(page);
return error; return error;
} }
......
...@@ -249,6 +249,7 @@ struct fuse_io_priv { ...@@ -249,6 +249,7 @@ struct fuse_io_priv {
size_t size; size_t size;
__u64 offset; __u64 offset;
bool write; bool write;
bool should_dirty;
int err; int err;
struct kiocb *iocb; struct kiocb *iocb;
struct file *file; struct file *file;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment