From patchwork Thu Dec 18 03:32:35 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gui Hecheng X-Patchwork-Id: 5510271 Return-Path: X-Original-To: patchwork-linux-btrfs@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id A07519F30B for ; Thu, 18 Dec 2014 03:35:26 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id C373620A16 for ; Thu, 18 Dec 2014 03:35:25 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 8FCD9209E3 for ; Thu, 18 Dec 2014 03:35:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751611AbaLRDep (ORCPT ); Wed, 17 Dec 2014 22:34:45 -0500 Received: from cn.fujitsu.com ([59.151.112.132]:43856 "EHLO heian.cn.fujitsu.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1751510AbaLRDeo (ORCPT ); Wed, 17 Dec 2014 22:34:44 -0500 X-IronPort-AV: E=Sophos;i="5.04,848,1406563200"; d="scan'208";a="45394484" Received: from unknown (HELO edo.cn.fujitsu.com) ([10.167.33.5]) by heian.cn.fujitsu.com with ESMTP; 18 Dec 2014 11:31:18 +0800 Received: from G08CNEXCHPEKD02.g08.fujitsu.local (localhost.localdomain [127.0.0.1]) by edo.cn.fujitsu.com (8.14.3/8.13.1) with ESMTP id sBI3YDgB001488 for ; Thu, 18 Dec 2014 11:34:13 +0800 Received: from localhost.localdomain (10.167.226.111) by G08CNEXCHPEKD02.g08.fujitsu.local (10.167.33.89) with Microsoft SMTP Server (TLS) id 14.3.181.6; Thu, 18 Dec 2014 11:34:38 +0800 From: Gui Hecheng To: CC: Gui Hecheng Subject: [PATCH] btrfs-progs: remove uneccessary subvol name check for subvol deletion Date: Thu, 18 Dec 2014 11:32:35 +0800 Message-ID: <1418873555-4530-1-git-send-email-guihc.fnst@cn.fujitsu.com> X-Mailer: git-send-email 1.8.1.4 MIME-Version: 1.0 X-Originating-IP: [10.167.226.111] Sender: linux-btrfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP When we want to delete a subvol, we first check to see whether it is a subvolume or not. After the check, we are sure that it is a valid subvol, don't have to check its name. Signed-off-by: Gui Hecheng --- cmds-subvolume.c | 15 --------------- 1 file changed, 15 deletions(-) diff --git a/cmds-subvolume.c b/cmds-subvolume.c index 53eec46..a35e2ad 100644 --- a/cmds-subvolume.c +++ b/cmds-subvolume.c @@ -281,21 +281,6 @@ again: vname = basename(dupvname); free(cpath); - if (!test_issubvolname(vname)) { - fprintf(stderr, "ERROR: incorrect subvolume name '%s'\n", - vname); - ret = 1; - goto out; - } - - len = strlen(vname); - if (len == 0 || len >= BTRFS_VOL_NAME_MAX) { - fprintf(stderr, "ERROR: snapshot name too long '%s'\n", - vname); - ret = 1; - goto out; - } - fd = open_file_or_dir(dname, &dirstream); if (fd < 0) { fprintf(stderr, "ERROR: can't access '%s'\n", dname);