From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.3 required=3.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED,DKIM_INVALID,DKIM_SIGNED,FREEMAIL_FORGED_FROMDOMAIN, FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 77A09C433DF for ; Mon, 17 Aug 2020 05:01:50 +0000 (UTC) Received: from lists.sourceforge.net (lists.sourceforge.net [216.105.38.7]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 3AA0B2072D; Mon, 17 Aug 2020 05:01:49 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=sourceforge.net header.i=@sourceforge.net header.b="KOz7FKex"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=sf.net header.i=@sf.net header.b="LKg++zvE"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="KbyWbUhm" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 3AA0B2072D Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=linux-f2fs-devel-bounces@lists.sourceforge.net Received: from [127.0.0.1] (helo=sfs-ml-2.v29.lw.sourceforge.com) by sfs-ml-2.v29.lw.sourceforge.com with esmtp (Exim 4.90_1) (envelope-from ) id 1k7XHI-0000Tk-9Q; Mon, 17 Aug 2020 05:01:48 +0000 Received: from [172.30.20.202] (helo=mx.sourceforge.net) by sfs-ml-2.v29.lw.sourceforge.com with esmtps (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.90_1) (envelope-from ) id 1k7XHH-0000Td-8G for linux-f2fs-devel@lists.sourceforge.net; Mon, 17 Aug 2020 05:01:47 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sourceforge.net; s=x; h=Content-Transfer-Encoding:MIME-Version:Message-Id: Date:Subject:Cc:To:From:Sender:Reply-To:Content-Type:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=cU/0kMT2iONxSrCBUFp2V6hP8+bSnUM691Eh6A9KOhI=; b=KOz7FKex3mSrEiWah83d8lsf+M Y5WGZXliLOQunVwYqlcL2fCLH6xrO2Ydg/mVvHtedbtrxOD64dF/FwlZjaaFfCDcnY9KrCZ/JFooi NuGJ7jo3JW3mLysOsOWe0M491u67UD+usB0fkaT2CX/TKvCqAgGBs7XZiFPtkWRKxYQg=; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sf.net; s=x ; h=Content-Transfer-Encoding:MIME-Version:Message-Id:Date:Subject:Cc:To:From :Sender:Reply-To:Content-Type:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To: References:List-Id:List-Help:List-Unsubscribe:List-Subscribe:List-Post: List-Owner:List-Archive; bh=cU/0kMT2iONxSrCBUFp2V6hP8+bSnUM691Eh6A9KOhI=; b=L Kg++zvExYaYNCc75a1+waMqUXppMgewjYhjPJCcaw0PnwfsEYQV9xE3u4eLuYw+LlZhJS3gthxRUr VTRJ5589L2Upeju2ILoyxhkEpMBVrdkHc6WBjve6KedNKBjnNNCyOSXASV0C6Rvmef7cJX+JXWiQr /C186GbKOv76OfZk=; Received: from mail-pg1-f194.google.com ([209.85.215.194]) by sfi-mx-4.v28.lw.sourceforge.com with esmtps (TLSv1.2:ECDHE-RSA-AES128-GCM-SHA256:128) (Exim 4.92.2) id 1k7XHC-00GnKk-QY for linux-f2fs-devel@lists.sourceforge.net; Mon, 17 Aug 2020 05:01:47 +0000 Received: by mail-pg1-f194.google.com with SMTP id j21so7537880pgi.9 for ; Sun, 16 Aug 2020 22:01:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=cU/0kMT2iONxSrCBUFp2V6hP8+bSnUM691Eh6A9KOhI=; b=KbyWbUhmgWcZFip/GW23yIieyXfLT4vrhNWaq4jbkcw8rYmVolIn9tJaap7nLUz9Ak hnNeyd+yHz/HSX1i1G3bAROpK8SzgW5+ahVwyH946LlQ4j+ihveid8FMh0GWf/QrUFSb swJAziw86uk8z76p/+SIIXGnbrQxlFV6ra+3+qXmAhKxGPopZgilhVBmPtGUoJXtwH8k NRcinTuDXRKG4dpFPrrZVxlRF43zPrr8GaMsMr1qzxZj8h/rVzN1FWfhWBjEzNm4GGSQ SZcGJ9z1/fQjPq5cDRgJA73oyzEMFHI+DLg63XcMZS0YPVR1/CBm0H31ZTC3X0pJUqzM vPbw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=cU/0kMT2iONxSrCBUFp2V6hP8+bSnUM691Eh6A9KOhI=; b=TpTv9liBcgnEvXuDww2rtJOp6Y5hJ6jVt4gq3Y/mU9fM3+nmxeb055rtSBXhXR1ruJ mdSqbpQhsXWhoZy/HWniq+sJDogw2V+L7rA+BSOeEnTZHHurkMV5qqvGMkr2DVlEDpP2 c+dx5S0iEhnuWrUDXaQBSNDlzs9jWe8+ob7ofSbCLsayLhbPmcihKg3oBWHIsLRcbzMG ZE2knCZah/u7oEZo53K1DqtaDqb2sqjYfOVtBHm68B4878BKpSNL/nheErWM0EfrntzG GWHMCqcQtSs08LuXFNzoC1+Mp49m66wThfzMpsgQECX05azygqsf7ffd4Az3/wbh7NxP z8SQ== X-Gm-Message-State: AOAM532VbeHfc4sTztJu23qD96uADPswLOniftPAQDRpIkeDBZYf9cml YoqEuMtcTTr/AK6B/HzKkC500f24FUCfYg== X-Google-Smtp-Source: ABdhPJx2aHWxHrYRtR6sYns3RHiZXkDMCsKUZztHQMQqh4BrCc6LKKKasRPnBWBfxl4n5wGxk1Tw7w== X-Received: by 2002:a65:4cca:: with SMTP id n10mr8855131pgt.323.1597640496682; Sun, 16 Aug 2020 22:01:36 -0700 (PDT) Received: from daehojeong1.seo.corp.google.com ([2401:fa00:d:1:a6ae:11ff:fe18:6ce2]) by smtp.gmail.com with ESMTPSA id e23sm15312124pgb.79.2020.08.16.22.01.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 16 Aug 2020 22:01:35 -0700 (PDT) From: Daeho Jeong To: linux-f2fs-devel@lists.sourceforge.net Date: Mon, 17 Aug 2020 14:01:30 +0900 Message-Id: <20200817050130.3504967-1-daeho43@gmail.com> X-Mailer: git-send-email 2.28.0.220.ged08abb693-goog MIME-Version: 1.0 X-Headers-End: 1k7XHC-00GnKk-QY Subject: [f2fs-dev] [PATCH] sload.f2fs: handle root mount point properly when setting file attribute X-BeenThere: linux-f2fs-devel@lists.sourceforge.net X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Daeho Jeong Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: linux-f2fs-devel-bounces@lists.sourceforge.net From: Daeho Jeong Need to remove "/" of mount point name from the file path name when mount point is "/". Otherwise, we will transfer file path name whose first two characters are like "//" to fs_config function. Signed-off-by: Daeho Jeong --- fsck/sload.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/fsck/sload.c b/fsck/sload.c index 59ba4a6..14012fb 100644 --- a/fsck/sload.c +++ b/fsck/sload.c @@ -104,10 +104,18 @@ static int set_perms_and_caps(struct dentry *de) uint64_t capabilities = 0; unsigned int uid = 0, gid = 0, imode = 0; char *mnt_path = NULL; + char *mount_path = c.mount_point; - if (asprintf(&mnt_path, "%s%s", c.mount_point, de->path) <= 0) { + /* + * de->path already has "/" in the beginning of it. + * Need to remove "/" when c.mount_point is "/", not to add it twice. + */ + if (strlen(c.mount_point) == 1 && c.mount_point[0] == '/') + mount_path = ""; + + if (asprintf(&mnt_path, "%s%s", mount_path, de->path) <= 0) { ERR_MSG("cannot allocate mount path for %s%s\n", - c.mount_point, de->path); + mount_path, de->path); return -ENOMEM; } -- 2.28.0.220.ged08abb693-goog _______________________________________________ Linux-f2fs-devel mailing list Linux-f2fs-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel