Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758431AbcLRS5e (ORCPT ); Sun, 18 Dec 2016 13:57:34 -0500 Received: from mail-wm0-f66.google.com ([74.125.82.66]:33579 "EHLO mail-wm0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752934AbcLRS5c (ORCPT ); Sun, 18 Dec 2016 13:57:32 -0500 From: Sami Kerola To: Al Viro , linux-fsdevel@vger.kernel.org Cc: linux-kernel@vger.kernel.org, Sami Kerola Subject: [PATCH] vfs: return EOPNOTSUPP when ioctl_fsthaw() is not supported Date: Sun, 18 Dec 2016 18:57:27 +0000 Message-Id: <20161218185727.2209-1-kerolasa@iki.fi> X-Mailer: git-send-email 2.11.0 Organization: Cloudflare Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 820 Lines: 27 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 --- 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