Skip to content

Commit eb98e3b

Browse files
author
Miklos Szeredi
committed
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>
1 parent 6b67573 commit eb98e3b

5 files changed

Lines changed: 12 additions & 11 deletions

File tree

‎fs/fuse/control.c‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,9 @@ static ssize_t fuse_conn_abort_write(struct file *file, const char __user *buf,
3535
{
3636
struct fuse_conn *fc = fuse_ctl_file_conn_get(file);
3737
if (fc) {
38-
fuse_abort_conn(fc, true);
38+
if (fc->abort_err)
39+
fc->aborted = true;
40+
fuse_abort_conn(fc);
3941
fuse_conn_put(fc);
4042
}
4143
return count;

‎fs/fuse/cuse.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -408,7 +408,7 @@ static void cuse_process_init_reply(struct fuse_conn *fc, struct fuse_req *req)
408408
err_region:
409409
unregister_chrdev_region(devt, 1);
410410
err:
411-
fuse_abort_conn(fc, false);
411+
fuse_abort_conn(fc);
412412
goto out;
413413
}
414414

@@ -587,7 +587,7 @@ static ssize_t cuse_class_abort_store(struct device *dev,
587587
{
588588
struct cuse_conn *cc = dev_get_drvdata(dev);
589589

590-
fuse_abort_conn(&cc->fc, false);
590+
fuse_abort_conn(&cc->fc);
591591
return count;
592592
}
593593
static DEVICE_ATTR(abort, 0200, NULL, cuse_class_abort_store);

‎fs/fuse/dev.c‎

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1330,7 +1330,7 @@ static ssize_t fuse_dev_do_read(struct fuse_dev *fud, struct file *file,
13301330
goto err_unlock;
13311331

13321332
if (!fiq->connected) {
1333-
err = (fc->aborted && fc->abort_err) ? -ECONNABORTED : -ENODEV;
1333+
err = fc->aborted ? -ECONNABORTED : -ENODEV;
13341334
goto err_unlock;
13351335
}
13361336

@@ -1377,7 +1377,7 @@ static ssize_t fuse_dev_do_read(struct fuse_dev *fud, struct file *file,
13771377
spin_lock(&fpq->lock);
13781378
clear_bit(FR_LOCKED, &req->flags);
13791379
if (!fpq->connected) {
1380-
err = (fc->aborted && fc->abort_err) ? -ECONNABORTED : -ENODEV;
1380+
err = fc->aborted ? -ECONNABORTED : -ENODEV;
13811381
goto out_end;
13821382
}
13831383
if (err) {
@@ -2177,7 +2177,7 @@ static void end_polls(struct fuse_conn *fc)
21772177
* is OK, the request will in that case be removed from the list before we touch
21782178
* it.
21792179
*/
2180-
void fuse_abort_conn(struct fuse_conn *fc, bool is_abort)
2180+
void fuse_abort_conn(struct fuse_conn *fc)
21812181
{
21822182
struct fuse_iqueue *fiq = &fc->iq;
21832183

@@ -2193,7 +2193,6 @@ void fuse_abort_conn(struct fuse_conn *fc, bool is_abort)
21932193
fc->connected = 0;
21942194
spin_unlock(&fc->bg_lock);
21952195

2196-
fc->aborted = is_abort;
21972196
fuse_set_initialized(fc);
21982197
list_for_each_entry(fud, &fc->devices, entry) {
21992198
struct fuse_pqueue *fpq = &fud->pq;
@@ -2271,7 +2270,7 @@ int fuse_dev_release(struct inode *inode, struct file *file)
22712270
/* Are we the last open device? */
22722271
if (atomic_dec_and_test(&fc->dev_count)) {
22732272
WARN_ON(fc->iq.fasync != NULL);
2274-
fuse_abort_conn(fc, false);
2273+
fuse_abort_conn(fc);
22752274
}
22762275
fuse_dev_free(fud);
22772276
}

‎fs/fuse/fuse_i.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -947,7 +947,7 @@ void fuse_request_send_background(struct fuse_conn *fc, struct fuse_req *req);
947947
bool fuse_request_queue_background(struct fuse_conn *fc, struct fuse_req *req);
948948

949949
/* Abort all requests */
950-
void fuse_abort_conn(struct fuse_conn *fc, bool is_abort);
950+
void fuse_abort_conn(struct fuse_conn *fc);
951951
void fuse_wait_aborted(struct fuse_conn *fc);
952952

953953
/**

‎fs/fuse/inode.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -379,7 +379,7 @@ void fuse_unlock_inode(struct inode *inode, bool locked)
379379

380380
static void fuse_umount_begin(struct super_block *sb)
381381
{
382-
fuse_abort_conn(get_fuse_conn_super(sb), false);
382+
fuse_abort_conn(get_fuse_conn_super(sb));
383383
}
384384

385385
static void fuse_send_destroy(struct fuse_conn *fc)
@@ -1245,7 +1245,7 @@ static void fuse_sb_destroy(struct super_block *sb)
12451245
if (fc) {
12461246
fuse_send_destroy(fc);
12471247

1248-
fuse_abort_conn(fc, false);
1248+
fuse_abort_conn(fc);
12491249
fuse_wait_aborted(fc);
12501250

12511251
down_write(&fc->killsb);

0 commit comments

Comments
 (0)