[<prev] [next>] [day] [month] [year] [list]
Message-ID: <20071228190718.GB4855@lst.de>
Date: Fri, 28 Dec 2007 20:07:18 +0100
From: Christoph Hellwig <hch@....de>
To: akpm@...l.org, linux-kernel@...r.kernel.org
Cc: arndb@...ibm.com, stefano.brivio@...imi.it
Subject: [PATCH 2/3] libfs: make simple attributes interruptible
Use mutex_lock_interruptible in simple_attr_read/write.
Index: linux-2.6.24-rc6/fs/libfs.c
===================================================================
--- linux-2.6.24-rc6.orig/fs/libfs.c 2007-12-28 19:51:56.000000000 +0100
+++ linux-2.6.24-rc6/fs/libfs.c 2007-12-28 19:52:22.000000000 +0100
@@ -634,7 +634,10 @@ ssize_t simple_attr_read(struct file *fi
if (!attr->get)
return -EACCES;
- mutex_lock(&attr->mutex);
+ ret = mutex_lock_interruptible(&attr->mutex);
+ if (ret)
+ return ret;
+
if (*ppos) { /* continued read */
size = strlen(attr->get_buf);
} else { /* first read */
@@ -666,7 +669,10 @@ ssize_t simple_attr_write(struct file *f
if (!attr->set)
return -EACCES;
- mutex_lock(&attr->mutex);
+ ret = mutex_lock_interruptible(&attr->mutex);
+ if (ret)
+ return ret;
+
ret = -EFAULT;
size = min(sizeof(attr->set_buf) - 1, len);
if (copy_from_user(attr->set_buf, buf, size))
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists