9p: Make all client spin locks IRQ safe
authorTom Tucker <tom@opengridcomputing.com>
Thu, 23 Oct 2008 21:31:02 +0000 (16:31 -0500)
committerEric Van Hensbergen <ericvh@gmail.com>
Wed, 5 Nov 2008 19:19:06 +0000 (13:19 -0600)
The client lock must be IRQ safe. Some of the lock acquisition paths
took regular spin locks.

Signed-off-by: Tom Tucker <tom@opengridcomputing.com>
Signed-off-by: Eric Van Hensbergen <ericvh@gmail.com>
net/9p/client.c

index 67717f69412e47c182f34715291ec83c979d6f73..f4e6c05b3c68fa0a7d67cae35f31fb4b0a786b21 100644 (file)
@@ -613,6 +613,7 @@ static struct p9_fid *p9_fid_create(struct p9_client *clnt)
 {
        int err;
        struct p9_fid *fid;
+       unsigned long flags;
 
        P9_DPRINTK(P9_DEBUG_FID, "clnt %p\n", clnt);
        fid = kmalloc(sizeof(struct p9_fid), GFP_KERNEL);
@@ -632,9 +633,9 @@ static struct p9_fid *p9_fid_create(struct p9_client *clnt)
        fid->clnt = clnt;
        fid->aux = NULL;
 
-       spin_lock(&clnt->lock);
+       spin_lock_irqsave(&clnt->lock, flags);
        list_add(&fid->flist, &clnt->fidlist);
-       spin_unlock(&clnt->lock);
+       spin_unlock_irqrestore(&clnt->lock, flags);
 
        return fid;
 
@@ -646,13 +647,14 @@ error:
 static void p9_fid_destroy(struct p9_fid *fid)
 {
        struct p9_client *clnt;
+       unsigned long flags;
 
        P9_DPRINTK(P9_DEBUG_FID, "fid %d\n", fid->fid);
        clnt = fid->clnt;
        p9_idpool_put(fid->fid, clnt->fidpool);
-       spin_lock(&clnt->lock);
+       spin_lock_irqsave(&clnt->lock, flags);
        list_del(&fid->flist);
-       spin_unlock(&clnt->lock);
+       spin_unlock_irqrestore(&clnt->lock, flags);
        kfree(fid);
 }