diff options
author | Miklos Szeredi <mszeredi@redhat.com> | 2019-01-24 04:40:16 -0500 |
---|---|---|
committer | Miklos Szeredi <mszeredi@redhat.com> | 2019-02-13 07:15:14 -0500 |
commit | eb98e3bdf3aa7b15b40c65063ea935f953f60c6b (patch) | |
tree | e4f78c73977fc0cc761e56c901b14d25d671dbd6 /fs/fuse | |
parent | 6b675738ce900dac8f8478b1d8487df420a315f3 (diff) |
fuse: clean up aborted
The only caller that needs fc->aborted set is fuse_conn_abort_write().
Setting fc->aborted is now racy (fuse_abort_conn() may already be in
progress or finished) but there's no reason to care.
Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
Diffstat (limited to 'fs/fuse')
-rw-r--r-- | fs/fuse/control.c | 4 | ||||
-rw-r--r-- | fs/fuse/cuse.c | 4 | ||||
-rw-r--r-- | fs/fuse/dev.c | 9 | ||||
-rw-r--r-- | fs/fuse/fuse_i.h | 2 | ||||
-rw-r--r-- | fs/fuse/inode.c | 4 |
5 files changed, 12 insertions, 11 deletions
diff --git a/fs/fuse/control.c b/fs/fuse/control.c index 989df5accaee..fe80bea4ad89 100644 --- a/fs/fuse/control.c +++ b/fs/fuse/control.c | |||
@@ -35,7 +35,9 @@ static ssize_t fuse_conn_abort_write(struct file *file, const char __user *buf, | |||
35 | { | 35 | { |
36 | struct fuse_conn *fc = fuse_ctl_file_conn_get(file); | 36 | struct fuse_conn *fc = fuse_ctl_file_conn_get(file); |
37 | if (fc) { | 37 | if (fc) { |
38 | fuse_abort_conn(fc, true); | 38 | if (fc->abort_err) |
39 | fc->aborted = true; | ||
40 | fuse_abort_conn(fc); | ||
39 | fuse_conn_put(fc); | 41 | fuse_conn_put(fc); |
40 | } | 42 | } |
41 | return count; | 43 | return count; |
diff --git a/fs/fuse/cuse.c b/fs/fuse/cuse.c index d73eba592ba1..55a26f351467 100644 --- a/fs/fuse/cuse.c +++ b/fs/fuse/cuse.c | |||
@@ -408,7 +408,7 @@ err_unlock: | |||
408 | err_region: | 408 | err_region: |
409 | unregister_chrdev_region(devt, 1); | 409 | unregister_chrdev_region(devt, 1); |
410 | err: | 410 | err: |
411 | fuse_abort_conn(fc, false); | 411 | fuse_abort_conn(fc); |
412 | goto out; | 412 | goto out; |
413 | } | 413 | } |
414 | 414 | ||
@@ -587,7 +587,7 @@ static ssize_t cuse_class_abort_store(struct device *dev, | |||
587 | { | 587 | { |
588 | struct cuse_conn *cc = dev_get_drvdata(dev); | 588 | struct cuse_conn *cc = dev_get_drvdata(dev); |
589 | 589 | ||
590 | fuse_abort_conn(&cc->fc, false); | 590 | fuse_abort_conn(&cc->fc); |
591 | return count; | 591 | return count; |
592 | } | 592 | } |
593 | static DEVICE_ATTR(abort, 0200, NULL, cuse_class_abort_store); | 593 | static DEVICE_ATTR(abort, 0200, NULL, cuse_class_abort_store); |
diff --git a/fs/fuse/dev.c b/fs/fuse/dev.c index 5a7309427e0e..8a63e52785e9 100644 --- a/fs/fuse/dev.c +++ b/fs/fuse/dev.c | |||
@@ -1330,7 +1330,7 @@ static ssize_t fuse_dev_do_read(struct fuse_dev *fud, struct file *file, | |||
1330 | goto err_unlock; | 1330 | goto err_unlock; |
1331 | 1331 | ||
1332 | if (!fiq->connected) { | 1332 | if (!fiq->connected) { |
1333 | err = (fc->aborted && fc->abort_err) ? -ECONNABORTED : -ENODEV; | 1333 | err = fc->aborted ? -ECONNABORTED : -ENODEV; |
1334 | goto err_unlock; | 1334 | goto err_unlock; |
1335 | } | 1335 | } |
1336 | 1336 | ||
@@ -1377,7 +1377,7 @@ static ssize_t fuse_dev_do_read(struct fuse_dev *fud, struct file *file, | |||
1377 | spin_lock(&fpq->lock); | 1377 | spin_lock(&fpq->lock); |
1378 | clear_bit(FR_LOCKED, &req->flags); | 1378 | clear_bit(FR_LOCKED, &req->flags); |
1379 | if (!fpq->connected) { | 1379 | if (!fpq->connected) { |
1380 | err = (fc->aborted && fc->abort_err) ? -ECONNABORTED : -ENODEV; | 1380 | err = fc->aborted ? -ECONNABORTED : -ENODEV; |
1381 | goto out_end; | 1381 | goto out_end; |
1382 | } | 1382 | } |
1383 | if (err) { | 1383 | if (err) { |
@@ -2177,7 +2177,7 @@ static void end_polls(struct fuse_conn *fc) | |||
2177 | * is OK, the request will in that case be removed from the list before we touch | 2177 | * is OK, the request will in that case be removed from the list before we touch |
2178 | * it. | 2178 | * it. |
2179 | */ | 2179 | */ |
2180 | void fuse_abort_conn(struct fuse_conn *fc, bool is_abort) | 2180 | void fuse_abort_conn(struct fuse_conn *fc) |
2181 | { | 2181 | { |
2182 | struct fuse_iqueue *fiq = &fc->iq; | 2182 | struct fuse_iqueue *fiq = &fc->iq; |
2183 | 2183 | ||
@@ -2193,7 +2193,6 @@ void fuse_abort_conn(struct fuse_conn *fc, bool is_abort) | |||
2193 | fc->connected = 0; | 2193 | fc->connected = 0; |
2194 | spin_unlock(&fc->bg_lock); | 2194 | spin_unlock(&fc->bg_lock); |
2195 | 2195 | ||
2196 | fc->aborted = is_abort; | ||
2197 | fuse_set_initialized(fc); | 2196 | fuse_set_initialized(fc); |
2198 | list_for_each_entry(fud, &fc->devices, entry) { | 2197 | list_for_each_entry(fud, &fc->devices, entry) { |
2199 | struct fuse_pqueue *fpq = &fud->pq; | 2198 | struct fuse_pqueue *fpq = &fud->pq; |
@@ -2271,7 +2270,7 @@ int fuse_dev_release(struct inode *inode, struct file *file) | |||
2271 | /* Are we the last open device? */ | 2270 | /* Are we the last open device? */ |
2272 | if (atomic_dec_and_test(&fc->dev_count)) { | 2271 | if (atomic_dec_and_test(&fc->dev_count)) { |
2273 | WARN_ON(fc->iq.fasync != NULL); | 2272 | WARN_ON(fc->iq.fasync != NULL); |
2274 | fuse_abort_conn(fc, false); | 2273 | fuse_abort_conn(fc); |
2275 | } | 2274 | } |
2276 | fuse_dev_free(fud); | 2275 | fuse_dev_free(fud); |
2277 | } | 2276 | } |
diff --git a/fs/fuse/fuse_i.h b/fs/fuse/fuse_i.h index 4fdd098e422d..b1ac587671ac 100644 --- a/fs/fuse/fuse_i.h +++ b/fs/fuse/fuse_i.h | |||
@@ -947,7 +947,7 @@ void fuse_request_send_background(struct fuse_conn *fc, struct fuse_req *req); | |||
947 | bool fuse_request_queue_background(struct fuse_conn *fc, struct fuse_req *req); | 947 | bool fuse_request_queue_background(struct fuse_conn *fc, struct fuse_req *req); |
948 | 948 | ||
949 | /* Abort all requests */ | 949 | /* Abort all requests */ |
950 | void fuse_abort_conn(struct fuse_conn *fc, bool is_abort); | 950 | void fuse_abort_conn(struct fuse_conn *fc); |
951 | void fuse_wait_aborted(struct fuse_conn *fc); | 951 | void fuse_wait_aborted(struct fuse_conn *fc); |
952 | 952 | ||
953 | /** | 953 | /** |
diff --git a/fs/fuse/inode.c b/fs/fuse/inode.c index 3d1a63e95f69..11aac2f4eda1 100644 --- a/fs/fuse/inode.c +++ b/fs/fuse/inode.c | |||
@@ -379,7 +379,7 @@ void fuse_unlock_inode(struct inode *inode, bool locked) | |||
379 | 379 | ||
380 | static void fuse_umount_begin(struct super_block *sb) | 380 | static void fuse_umount_begin(struct super_block *sb) |
381 | { | 381 | { |
382 | fuse_abort_conn(get_fuse_conn_super(sb), false); | 382 | fuse_abort_conn(get_fuse_conn_super(sb)); |
383 | } | 383 | } |
384 | 384 | ||
385 | static void fuse_send_destroy(struct fuse_conn *fc) | 385 | static void fuse_send_destroy(struct fuse_conn *fc) |
@@ -1245,7 +1245,7 @@ static void fuse_sb_destroy(struct super_block *sb) | |||
1245 | if (fc) { | 1245 | if (fc) { |
1246 | fuse_send_destroy(fc); | 1246 | fuse_send_destroy(fc); |
1247 | 1247 | ||
1248 | fuse_abort_conn(fc, false); | 1248 | fuse_abort_conn(fc); |
1249 | fuse_wait_aborted(fc); | 1249 | fuse_wait_aborted(fc); |
1250 | 1250 | ||
1251 | down_write(&fc->killsb); | 1251 | down_write(&fc->killsb); |