diff mbox

[V9fs-developer] Small patch

Message ID 20091027232418.GA7574@llnl.gov (mailing list archive)
State Superseded, archived
Headers show

Commit Message

Jim Garlick Oct. 27, 2009, 11:24 p.m. UTC
None
diff mbox

Patch

Index: include/net/9p/client.h
===================================================================
--- include/net/9p/client.h     (revision 9145)
+++ include/net/9p/client.h     (working copy)
@@ -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 */
 };
Index: v9fs/vfs_dir.c
===================================================================
--- v9fs/vfs_dir.c      (revision 9137)
+++ v9fs/vfs_dir.c      (working copy)
@@ -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);
Index: 9p/client.c
===================================================================
--- 9p/client.c (revision 9145)
+++ 9p/client.c (working copy)
@@ -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
Index: include/net/9p/client.h
===================================================================
--- include/net/9p/client.h     (revision 9145)
+++ include/net/9p/client.h     (working copy)
@@ -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 */
 };
Index: v9fs/vfs_dir.c
===================================================================
--- v9fs/vfs_dir.c      (revision 9137)
+++ v9fs/vfs_dir.c      (working copy)
@@ -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);
Index: 9p/client.c
===================================================================
--- 9p/client.c (revision 9145)
+++ 9p/client.c (working copy)
@@ -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;