diff options
author | Miklos Szeredi <miklos@szeredi.hu> | 2006-01-06 03:19:39 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-01-06 11:33:55 -0500 |
commit | 248d86e87d12da19eee602075f05a49a5215288b (patch) | |
tree | dd6a1159db054102100b2dd37e67022a65dbcf73 /fs/fuse | |
parent | 6f9f11806af8ad3a107714a3ece56c1c4fafd047 (diff) |
[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>
Diffstat (limited to 'fs/fuse')
-rw-r--r-- | fs/fuse/dir.c | 7 | ||||
-rw-r--r-- | fs/fuse/file.c | 35 |
2 files changed, 37 insertions, 5 deletions
diff --git a/fs/fuse/dir.c b/fs/fuse/dir.c index fead7f49e2ca..9a6075de961f 100644 --- a/fs/fuse/dir.c +++ b/fs/fuse/dir.c | |||
@@ -773,7 +773,12 @@ static int fuse_readdir(struct file *file, void *dstbuf, filldir_t filldir) | |||
773 | struct page *page; | 773 | struct page *page; |
774 | struct inode *inode = file->f_dentry->d_inode; | 774 | struct inode *inode = file->f_dentry->d_inode; |
775 | struct fuse_conn *fc = get_fuse_conn(inode); | 775 | struct fuse_conn *fc = get_fuse_conn(inode); |
776 | struct fuse_req *req = fuse_get_request(fc); | 776 | struct fuse_req *req; |
777 | |||
778 | if (is_bad_inode(inode)) | ||
779 | return -EIO; | ||
780 | |||
781 | req = fuse_get_request(fc); | ||
777 | if (!req) | 782 | if (!req) |
778 | return -EINTR; | 783 | return -EINTR; |
779 | 784 | ||
diff --git a/fs/fuse/file.c b/fs/fuse/file.c index 18aafa6c9af4..c989f0e9456b 100644 --- a/fs/fuse/file.c +++ b/fs/fuse/file.c | |||
@@ -163,6 +163,9 @@ static int fuse_flush(struct file *file) | |||
163 | struct fuse_flush_in inarg; | 163 | struct fuse_flush_in inarg; |
164 | int err; | 164 | int err; |
165 | 165 | ||
166 | if (is_bad_inode(inode)) | ||
167 | return -EIO; | ||
168 | |||
166 | if (fc->no_flush) | 169 | if (fc->no_flush) |
167 | return 0; | 170 | return 0; |
168 | 171 | ||
@@ -199,6 +202,9 @@ int fuse_fsync_common(struct file *file, struct dentry *de, int datasync, | |||
199 | struct fuse_fsync_in inarg; | 202 | struct fuse_fsync_in inarg; |
200 | int err; | 203 | int err; |
201 | 204 | ||
205 | if (is_bad_inode(inode)) | ||
206 | return -EIO; | ||
207 | |||
202 | if ((!isdir && fc->no_fsync) || (isdir && fc->no_fsyncdir)) | 208 | if ((!isdir && fc->no_fsync) || (isdir && fc->no_fsyncdir)) |
203 | return 0; | 209 | return 0; |
204 | 210 | ||
@@ -272,8 +278,15 @@ static int fuse_readpage(struct file *file, struct page *page) | |||
272 | { | 278 | { |
273 | struct inode *inode = page->mapping->host; | 279 | struct inode *inode = page->mapping->host; |
274 | struct fuse_conn *fc = get_fuse_conn(inode); | 280 | struct fuse_conn *fc = get_fuse_conn(inode); |
275 | struct fuse_req *req = fuse_get_request(fc); | 281 | struct fuse_req *req; |
276 | int err = -EINTR; | 282 | int err; |
283 | |||
284 | err = -EIO; | ||
285 | if (is_bad_inode(inode)) | ||
286 | goto out; | ||
287 | |||
288 | err = -EINTR; | ||
289 | req = fuse_get_request(fc); | ||
277 | if (!req) | 290 | if (!req) |
278 | goto out; | 291 | goto out; |
279 | 292 | ||
@@ -344,6 +357,10 @@ static int fuse_readpages(struct file *file, struct address_space *mapping, | |||
344 | struct fuse_conn *fc = get_fuse_conn(inode); | 357 | struct fuse_conn *fc = get_fuse_conn(inode); |
345 | struct fuse_readpages_data data; | 358 | struct fuse_readpages_data data; |
346 | int err; | 359 | int err; |
360 | |||
361 | if (is_bad_inode(inode)) | ||
362 | return -EIO; | ||
363 | |||
347 | data.file = file; | 364 | data.file = file; |
348 | data.inode = inode; | 365 | data.inode = inode; |
349 | data.req = fuse_get_request(fc); | 366 | data.req = fuse_get_request(fc); |
@@ -402,7 +419,12 @@ static int fuse_commit_write(struct file *file, struct page *page, | |||
402 | struct inode *inode = page->mapping->host; | 419 | struct inode *inode = page->mapping->host; |
403 | struct fuse_conn *fc = get_fuse_conn(inode); | 420 | struct fuse_conn *fc = get_fuse_conn(inode); |
404 | loff_t pos = page_offset(page) + offset; | 421 | loff_t pos = page_offset(page) + offset; |
405 | struct fuse_req *req = fuse_get_request(fc); | 422 | struct fuse_req *req; |
423 | |||
424 | if (is_bad_inode(inode)) | ||
425 | return -EIO; | ||
426 | |||
427 | req = fuse_get_request(fc); | ||
406 | if (!req) | 428 | if (!req) |
407 | return -EINTR; | 429 | return -EINTR; |
408 | 430 | ||
@@ -474,7 +496,12 @@ static ssize_t fuse_direct_io(struct file *file, const char __user *buf, | |||
474 | size_t nmax = write ? fc->max_write : fc->max_read; | 496 | size_t nmax = write ? fc->max_write : fc->max_read; |
475 | loff_t pos = *ppos; | 497 | loff_t pos = *ppos; |
476 | ssize_t res = 0; | 498 | ssize_t res = 0; |
477 | struct fuse_req *req = fuse_get_request(fc); | 499 | struct fuse_req *req; |
500 | |||
501 | if (is_bad_inode(inode)) | ||
502 | return -EIO; | ||
503 | |||
504 | req = fuse_get_request(fc); | ||
478 | if (!req) | 505 | if (!req) |
479 | return -EINTR; | 506 | return -EINTR; |
480 | 507 | ||