mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch@lst.de>
To: akpm@osdl.org, linux-kernel@vger.kernel.org
Cc: arndb@de.ibm.com, stefano.brivio@polimi.it
Subject: [PATCH 2/3] libfs: make simple attributes interruptible
Date: Fri, 28 Dec 2007 20:07:18 +0100	[thread overview]
Message-ID: <20071228190718.GB4855@lst.de> (raw)

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))

                 reply	other threads:[~2007-12-28 19:07 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20071228190718.GB4855@lst.de \
    --to=hch@lst.de \
    --cc=akpm@osdl.org \
    --cc=arndb@de.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=stefano.brivio@polimi.it \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®