lkml.org 
[lkml]   [2007]   [Dec]   [28]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
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))

\
 
 \ /
  Last update: 2007-12-28 20:11    [W:2.059 / U:0.052 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site