mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-28 10:41:38 -04:00
9p: fix readdir corner cases
The patch below also addresses a couple of other corner cases in readdir seen with a large (e.g. 64k) msize. I'm not sure what people think of my co-opting of fid->aux here. I'd be happy to rework if there's a better way. When the size of the user supplied buffer passed to readdir is smaller than the data returned in one go by the 9P read request, v9fs_dir_readdir() currently discards extra data so that, on the next call, a 9P read request will be issued with offset < previous offset + bytes returned, which voilates the constraint described in paragraph 3 of read(5) description. This patch preseves the leftover data in fid->aux for use in the next call. Signed-off-by: Jim Garlick <[email protected]> Signed-off-by: Eric Van Hensbergen <[email protected]>
This commit is contained in:
parent
2511cd0b3b
commit
3e2796a90c
3 changed files with 72 additions and 34 deletions
|
|
@ -582,11 +582,9 @@ static struct p9_fid *p9_fid_create(struct p9_client *clnt)
|
|||
|
||||
memset(&fid->qid, 0, sizeof(struct p9_qid));
|
||||
fid->mode = -1;
|
||||
fid->rdir_fpos = 0;
|
||||
fid->uid = current_fsuid();
|
||||
fid->clnt = clnt;
|
||||
fid->aux = NULL;
|
||||
|
||||
fid->rdir = NULL;
|
||||
spin_lock_irqsave(&clnt->lock, flags);
|
||||
list_add(&fid->flist, &clnt->fidlist);
|
||||
spin_unlock_irqrestore(&clnt->lock, flags);
|
||||
|
|
@ -609,6 +607,7 @@ static void p9_fid_destroy(struct p9_fid *fid)
|
|||
spin_lock_irqsave(&clnt->lock, flags);
|
||||
list_del(&fid->flist);
|
||||
spin_unlock_irqrestore(&clnt->lock, flags);
|
||||
kfree(fid->rdir);
|
||||
kfree(fid);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue