Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 25717
b: refs/heads/master
c: 9bc5ddd
h: refs/heads/master
i:
  25715: 3935c0b
v: v3
  • Loading branch information
Miklos Szeredi committed Apr 11, 2006
1 parent c7509f2 commit cda9ac3
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 7 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 73ce8355c243a434524a34c05cc417dd0467996e
refs/heads/master: 9bc5dddad1294955e70eeb87325ba1505fb5fe2e
25 changes: 19 additions & 6 deletions trunk/fs/fuse/dev.c
Original file line number Diff line number Diff line change
Expand Up @@ -92,30 +92,39 @@ struct fuse_req *fuse_get_req(struct fuse_conn *fc)
{
struct fuse_req *req;
sigset_t oldset;
int intr;
int err;

atomic_inc(&fc->num_waiting);
block_sigs(&oldset);
err = wait_event_interruptible(fc->blocked_waitq, !fc->blocked);
intr = wait_event_interruptible(fc->blocked_waitq, !fc->blocked);
restore_sigs(&oldset);
if (err)
return ERR_PTR(-EINTR);
err = -EINTR;
if (intr)
goto out;

req = fuse_request_alloc();
err = -ENOMEM;
if (!req)
return ERR_PTR(-ENOMEM);
goto out;

atomic_inc(&fc->num_waiting);
fuse_request_init(req);
req->in.h.uid = current->fsuid;
req->in.h.gid = current->fsgid;
req->in.h.pid = current->pid;
req->waiting = 1;
return req;

out:
atomic_dec(&fc->num_waiting);
return ERR_PTR(err);
}

void fuse_put_request(struct fuse_conn *fc, struct fuse_req *req)
{
if (atomic_dec_and_test(&req->count)) {
atomic_dec(&fc->num_waiting);
if (req->waiting)
atomic_dec(&fc->num_waiting);
fuse_request_free(req);
}
}
Expand Down Expand Up @@ -281,6 +290,10 @@ static void queue_request(struct fuse_conn *fc, struct fuse_req *req)
len_args(req->in.numargs, (struct fuse_arg *) req->in.args);
list_add_tail(&req->list, &fc->pending);
req->state = FUSE_REQ_PENDING;
if (!req->waiting) {
req->waiting = 1;
atomic_inc(&fc->num_waiting);
}
wake_up(&fc->waitq);
kill_fasync(&fc->fasync, SIGIO, POLL_IN);
}
Expand Down
3 changes: 3 additions & 0 deletions trunk/fs/fuse/fuse_i.h
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,9 @@ struct fuse_req {
/** Data is being copied to/from the request */
unsigned locked:1;

/** Request is counted as "waiting" */
unsigned waiting:1;

/** State of the request */
enum fuse_req_state state;

Expand Down

0 comments on commit cda9ac3

Please sign in to comment.