mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-08-21 00:10:09 +00:00
[PATCH] fuse: fail file operations on bad inode
Make file operations on a bad inode fail. This just makes things a bit more consistent. Signed-off-by: Miklos Szeredi <miklos@szeredi.hu> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
This commit is contained in:
parent
6f9f11806a
commit
248d86e87d
2 changed files with 37 additions and 5 deletions
|
@ -773,7 +773,12 @@ static int fuse_readdir(struct file *file, void *dstbuf, filldir_t filldir)
|
||||||
struct page *page;
|
struct page *page;
|
||||||
struct inode *inode = file->f_dentry->d_inode;
|
struct inode *inode = file->f_dentry->d_inode;
|
||||||
struct fuse_conn *fc = get_fuse_conn(inode);
|
struct fuse_conn *fc = get_fuse_conn(inode);
|
||||||
struct fuse_req *req = fuse_get_request(fc);
|
struct fuse_req *req;
|
||||||
|
|
||||||
|
if (is_bad_inode(inode))
|
||||||
|
return -EIO;
|
||||||
|
|
||||||
|
req = fuse_get_request(fc);
|
||||||
if (!req)
|
if (!req)
|
||||||
return -EINTR;
|
return -EINTR;
|
||||||
|
|
||||||
|
|
|
@ -163,6 +163,9 @@ static int fuse_flush(struct file *file)
|
||||||
struct fuse_flush_in inarg;
|
struct fuse_flush_in inarg;
|
||||||
int err;
|
int err;
|
||||||
|
|
||||||
|
if (is_bad_inode(inode))
|
||||||
|
return -EIO;
|
||||||
|
|
||||||
if (fc->no_flush)
|
if (fc->no_flush)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
@ -199,6 +202,9 @@ int fuse_fsync_common(struct file *file, struct dentry *de, int datasync,
|
||||||
struct fuse_fsync_in inarg;
|
struct fuse_fsync_in inarg;
|
||||||
int err;
|
int err;
|
||||||
|
|
||||||
|
if (is_bad_inode(inode))
|
||||||
|
return -EIO;
|
||||||
|
|
||||||
if ((!isdir && fc->no_fsync) || (isdir && fc->no_fsyncdir))
|
if ((!isdir && fc->no_fsync) || (isdir && fc->no_fsyncdir))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
@ -272,8 +278,15 @@ static int fuse_readpage(struct file *file, struct page *page)
|
||||||
{
|
{
|
||||||
struct inode *inode = page->mapping->host;
|
struct inode *inode = page->mapping->host;
|
||||||
struct fuse_conn *fc = get_fuse_conn(inode);
|
struct fuse_conn *fc = get_fuse_conn(inode);
|
||||||
struct fuse_req *req = fuse_get_request(fc);
|
struct fuse_req *req;
|
||||||
int err = -EINTR;
|
int err;
|
||||||
|
|
||||||
|
err = -EIO;
|
||||||
|
if (is_bad_inode(inode))
|
||||||
|
goto out;
|
||||||
|
|
||||||
|
err = -EINTR;
|
||||||
|
req = fuse_get_request(fc);
|
||||||
if (!req)
|
if (!req)
|
||||||
goto out;
|
goto out;
|
||||||
|
|
||||||
|
@ -344,6 +357,10 @@ static int fuse_readpages(struct file *file, struct address_space *mapping,
|
||||||
struct fuse_conn *fc = get_fuse_conn(inode);
|
struct fuse_conn *fc = get_fuse_conn(inode);
|
||||||
struct fuse_readpages_data data;
|
struct fuse_readpages_data data;
|
||||||
int err;
|
int err;
|
||||||
|
|
||||||
|
if (is_bad_inode(inode))
|
||||||
|
return -EIO;
|
||||||
|
|
||||||
data.file = file;
|
data.file = file;
|
||||||
data.inode = inode;
|
data.inode = inode;
|
||||||
data.req = fuse_get_request(fc);
|
data.req = fuse_get_request(fc);
|
||||||
|
@ -402,7 +419,12 @@ static int fuse_commit_write(struct file *file, struct page *page,
|
||||||
struct inode *inode = page->mapping->host;
|
struct inode *inode = page->mapping->host;
|
||||||
struct fuse_conn *fc = get_fuse_conn(inode);
|
struct fuse_conn *fc = get_fuse_conn(inode);
|
||||||
loff_t pos = page_offset(page) + offset;
|
loff_t pos = page_offset(page) + offset;
|
||||||
struct fuse_req *req = fuse_get_request(fc);
|
struct fuse_req *req;
|
||||||
|
|
||||||
|
if (is_bad_inode(inode))
|
||||||
|
return -EIO;
|
||||||
|
|
||||||
|
req = fuse_get_request(fc);
|
||||||
if (!req)
|
if (!req)
|
||||||
return -EINTR;
|
return -EINTR;
|
||||||
|
|
||||||
|
@ -474,7 +496,12 @@ static ssize_t fuse_direct_io(struct file *file, const char __user *buf,
|
||||||
size_t nmax = write ? fc->max_write : fc->max_read;
|
size_t nmax = write ? fc->max_write : fc->max_read;
|
||||||
loff_t pos = *ppos;
|
loff_t pos = *ppos;
|
||||||
ssize_t res = 0;
|
ssize_t res = 0;
|
||||||
struct fuse_req *req = fuse_get_request(fc);
|
struct fuse_req *req;
|
||||||
|
|
||||||
|
if (is_bad_inode(inode))
|
||||||
|
return -EIO;
|
||||||
|
|
||||||
|
req = fuse_get_request(fc);
|
||||||
if (!req)
|
if (!req)
|
||||||
return -EINTR;
|
return -EINTR;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue