diff options
author | Christoph Hellwig <hch@lst.de> | 2008-02-08 04:20:27 -0800 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2008-02-08 09:22:34 -0800 |
commit | 9261303ab7589cda6a3b95f9f80c9063538dc335 (patch) | |
tree | 03a46d0bb81dd0d0e56f3f3d73a15a42e698076a /fs/libfs.c | |
parent | 8b88b0998e35d239e74446cc30f354bdab86df89 (diff) | |
download | op-kernel-dev-9261303ab7589cda6a3b95f9f80c9063538dc335.zip op-kernel-dev-9261303ab7589cda6a3b95f9f80c9063538dc335.tar.gz |
libfs: make simple attributes interruptible
Use mutex_lock_interruptible in simple_attr_read/write.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Cc: <stefano.brivio@polimi.it>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Greg KH <greg@kroah.com>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'fs/libfs.c')
-rw-r--r-- | fs/libfs.c | 10 |
1 files changed, 8 insertions, 2 deletions
@@ -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)) |