mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Sami Kerola <kerolasa@iki.fi>
To: Al Viro <viro@zeniv.linux.org.uk>, linux-fsdevel@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, Sami Kerola <kerolasa@iki.fi>
Subject: [PATCH] vfs: return EOPNOTSUPP when ioctl_fsthaw() is not supported
Date: Sun, 18 Dec 2016 18:57:27 +0000	[thread overview]
Message-ID: <20161218185727.2209-1-kerolasa@iki.fi> (raw)

An attempt to freeze a filesystem that does not support such operation is
reported as EOPNOTSUPP to user.  Running unfreeze to the same filesystem
returns EINVAL.  Later is a little misleading, users can mix that message
with return value from unfreezing when filesystem is not frozen.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
---
 fs/ioctl.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/fs/ioctl.c b/fs/ioctl.c
index cb9b02940805..1d6372ef4008 100644
--- a/fs/ioctl.c
+++ b/fs/ioctl.c
@@ -566,6 +566,10 @@ static int ioctl_fsthaw(struct file *filp)
 	if (!capable(CAP_SYS_ADMIN))
 		return -EPERM;
 
+	/* If filesystem doesn't support thaw feature, return. */
+	if (!sb->s_op->unfreeze_fs)
+		return -EOPNOTSUPP;
+
 	/* Thaw */
 	if (sb->s_op->thaw_super)
 		return sb->s_op->thaw_super(sb);
-- 
2.11.0

             reply	other threads:[~2016-12-18 18:57 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-12-18 18:57 Sami Kerola [this message]
2016-12-19 10:24 ` Christoph Hellwig
2016-12-19 22:33   ` Sami Kerola

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=20161218185727.2209-1-kerolasa@iki.fi \
    --to=kerolasa@iki.fi \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=viro@zeniv.linux.org.uk \
    /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®