forked from TencentOS/TencentOS-kernel
fuse: add a dev ioctl for recovery
For a simple read-only file system, as long as the connection is not broken, the recovery of the user-mode read-only file system process can be realized by putting the request of the processing list back into the pending list. Signed-off-by: Peng Hao <flyingpeng@tencent.com>
This commit is contained in:
parent
06d37efeef
commit
e1c207b3e7
|
|
@ -2255,6 +2255,30 @@ static long fuse_dev_ioctl(struct file *file, unsigned int cmd,
|
|||
}
|
||||
}
|
||||
}
|
||||
if (cmd == FUSE_DEV_IOC_RECOVERY) {
|
||||
struct fuse_dev *fud = fuse_get_dev(file);
|
||||
struct fuse_iqueue *fiq = &fud->fc->iq;
|
||||
struct fuse_pqueue *fpq = &fud->pq;
|
||||
struct fuse_req *req, *next;
|
||||
LIST_HEAD(recovery);
|
||||
unsigned int i;
|
||||
|
||||
spin_lock(&fpq->lock);
|
||||
for (i = 0; i < FUSE_PQ_HASH_SIZE; i++)
|
||||
list_splice_tail_init(&fpq->processing[i],
|
||||
&recovery);
|
||||
spin_unlock(&fpq->lock);
|
||||
|
||||
list_for_each_entry_safe(req, next, &recovery, list) {
|
||||
clear_bit(FR_SENT, &req->flags);
|
||||
set_bit(FR_PENDING, &req->flags);
|
||||
}
|
||||
|
||||
spin_lock(&fiq->lock);
|
||||
list_splice(&recovery, &fiq->pending);
|
||||
spin_unlock(&fiq->lock);
|
||||
err = 0;
|
||||
}
|
||||
return err;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -870,6 +870,7 @@ struct fuse_notify_retrieve_in {
|
|||
|
||||
/* Device ioctls: */
|
||||
#define FUSE_DEV_IOC_CLONE _IOR(229, 0, uint32_t)
|
||||
#define FUSE_DEV_IOC_RECOVERY _IOR(230, 0, uint32_t)
|
||||
|
||||
struct fuse_lseek_in {
|
||||
uint64_t fh;
|
||||
|
|
|
|||
Loading…
Reference in New Issue