From patchwork Thu May 21 15:42:29 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Emil Karlson X-Patchwork-Id: 6456671 Return-Path: X-Original-To: patchwork-linux-btrfs@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 3A47CC0020 for ; Thu, 21 May 2015 15:52:51 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id C32C820443 for ; Thu, 21 May 2015 15:52:45 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id D221F202AE for ; Thu, 21 May 2015 15:52:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755745AbbEUPwd (ORCPT ); Thu, 21 May 2015 11:52:33 -0400 Received: from smtp-out-01.aalto.fi ([130.233.228.120]:59271 "EHLO smtp-out-01.aalto.fi" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755347AbbEUPwb (ORCPT ); Thu, 21 May 2015 11:52:31 -0400 X-Greylist: delayed 596 seconds by postgrey-1.27 at vger.kernel.org; Thu, 21 May 2015 11:52:31 EDT Received: from smtp-out-01.aalto.fi (localhost.localdomain [127.0.0.1]) by localhost (Email Security Appliance) with SMTP id 2E844115301_55DFCE8B; Thu, 21 May 2015 15:42:32 +0000 (GMT) Received: from lyta.localdomain (lyta.org.aalto.fi [130.233.224.198]) by smtp-out-01.aalto.fi (Sophos Email Appliance) with ESMTP id 0CB441152FB_55DFCE8F; Thu, 21 May 2015 15:42:32 +0000 (GMT) Received: by lyta.localdomain (Postfix, from userid 1346924) id 062BEE0C1F; Thu, 21 May 2015 18:42:31 +0300 (EEST) From: jekarlson@gmail.com To: linux-btrfs@vger.kernel.org Cc: Emil Karlson Subject: [PATCH] btrfs-progs: use openat for process_clone in receive Date: Thu, 21 May 2015 18:42:29 +0300 Message-Id: <1432222949-604-1-git-send-email-jekarlson@gmail.com> X-Mailer: git-send-email 1.7.9.5 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, DKIM_ADSP_CUSTOM_MED, FREEMAIL_FROM,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 From: Emil Karlson This will fix breakage, when doing chrooted receive with cloned paths outside main subvolume. --- cmds-receive.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cmds-receive.c b/cmds-receive.c index b7cf3f9..b0a312c 100644 --- a/cmds-receive.c +++ b/cmds-receive.c @@ -609,9 +609,9 @@ static int process_clone(const char *path, u64 offset, u64 len, subvol_path = strdup(si->path); } - full_clone_path = path_cat3(r->root_path, subvol_path, clone_path); + full_clone_path = path_cat(subvol_path, clone_path); - clone_fd = open(full_clone_path, O_RDONLY | O_NOATIME); + clone_fd = openat(r->mnt_fd, full_clone_path, O_RDONLY | O_NOATIME); if (clone_fd < 0) { ret = -errno; fprintf(stderr, "ERROR: failed to open %s. %s\n",