From: Christoph Hellwig Date: Fri, 8 Feb 2008 12:20:27 +0000 (-0800) Subject: libfs: make simple attributes interruptible X-Git-Tag: v2.6.25-rc1~152 X-Git-Url: http://pilppa.com/gitweb/?a=commitdiff_plain;h=9261303ab7589cda6a3b95f9f80c9063538dc335;p=linux-2.6-omap-h63xx.git libfs: make simple attributes interruptible Use mutex_lock_interruptible in simple_attr_read/write. Signed-off-by: Christoph Hellwig Cc: Cc: Arnd Bergmann Cc: Greg KH Cc: Al Viro Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- diff --git a/fs/libfs.c b/fs/libfs.c index 2319415ddb5..d6de56a6e18 100644 --- a/fs/libfs.c +++ b/fs/libfs.c @@ -634,7 +634,10 @@ ssize_t simple_attr_read(struct file *file, char __user *buf, 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 *file, const char __user *buf, 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))