===================================================================
@@ -178,6 +178,7 @@
void *aux;
int rdir_fpos;
+ struct mutex rdir_lock;
struct list_head flist;
struct list_head dlist; /* list of all fids attached to a dentry */
};
===================================================================
@@ -84,6 +84,9 @@
if (!statbuf)
return -ENOMEM;
+ if ((err = mutex_lock_interruptible(&fid->rdir_lock)))
+ goto free_and_exit;
+
while (1) {
if (fid->rdir_fpos > filp->f_pos) {
n = fid->rdir_fpos - filp->f_pos;
@@ -129,6 +132,7 @@
i += reclen;
}
}
+ mutex_unlock(&fid->rdir_lock);
free_and_exit:
kfree(statbuf);
===================================================================
@@ -589,6 +589,7 @@
memset(&fid->qid, 0, sizeof(struct p9_qid));
fid->mode = -1;
fid->rdir_fpos = 0;
+ mutex_init(&fid->rdir_lock);
fid->uid = current_fsuid();
fid->clnt = clnt;
fid->aux = NULL;
mrhankey /home/garlick/work/v9fs > vi v9fs/vfs_dir.c
mrhankey /home/garlick/work/v9fs > svn diff
===================================================================
@@ -178,6 +178,7 @@
void *aux;
int rdir_fpos;
+ struct mutex rdir_lock;
struct list_head flist;
struct list_head dlist; /* list of all fids attached to a dentry */
};
===================================================================
@@ -84,6 +84,9 @@
if (!statbuf)
return -ENOMEM;
+ if ((err = mutex_lock_interruptible(&fid->rdir_lock)))
+ goto free_and_exit;
+
while (1) {
if (fid->rdir_fpos > filp->f_pos) {
n = fid->rdir_fpos - filp->f_pos;
@@ -129,6 +132,7 @@
i += reclen;
}
}
+ mutex_unlock(&fid->rdir_lock);
free_and_exit:
kfree(statbuf);
===================================================================
@@ -589,6 +589,7 @@
memset(&fid->qid, 0, sizeof(struct p9_qid));
fid->mode = -1;
fid->rdir_fpos = 0;
+ mutex_init(&fid->rdir_lock);
fid->uid = current_fsuid();
fid->clnt = clnt;
fid->aux = NULL;