Received: by 2002:a05:6a10:8a4d:0:0:0:0 with SMTP id dn13csp960408pxb; Fri, 13 Aug 2021 10:05:51 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyMs5pYTN3zmrd6Y0ZfN7Bl8+1BlLLyiVcWLV+skXA7VnWHwk7Ne2jj4klPhX8Pnbl6rUs/ X-Received: by 2002:a92:d103:: with SMTP id a3mr2430468ilb.0.1628874350820; Fri, 13 Aug 2021 10:05:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1628874350; cv=none; d=google.com; s=arc-20160816; b=Ur4w10vyHCIe0ofClSP8yiytBioCMyutN8NwAhTTe8CQVrFrGbPY1nkgY1GLXY4Zjc 42udEudeDlu9pNRExED0WfZys2HfgglK85FKk52k9mmc0IzwVUYI2HAlXUgjGqC9qDGQ x7YUDMt5ujvezFaRj1WS/I5EXdDmwYhFyoNgGw36hU15mUCei8dkbR3u5o3Dgnl1T2A3 QN4hYNROtUOjRKon6+tBaZYadpVXQR0D1GNKEtrz8xvDOOYkLBb3GbdUcuLOyJn8rFYF vHhQLcRlz3/8XFPe/YKV9f/xBV5cqSQiwNZd0bkya2+LqXHohxc/cyA1a3N0+TjYxwMU J7gA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=QSmlTKOX8tPJ6fGuMvys1ad82ivbKQCmo1qyTnwmv4c=; b=k2mmpzEYnqik0ahRtPgVwMSWtwJ/zXDzN+zMai6n3yTaZMLjDw9VlHDT3SfVGebly/ FyU3RnnvTe+LC4L/K4YudHoNWvAilkhIFGRkaOWsUKhDrWsNWX3zRj9Ta7hRR4ZA8GIR /qlTelVSndFFLiQZtlv10FvC4qSHCCsaWKo3Y82DlD/h7CfKfab4IalPNIwVw1/AC7id sZqUEBjJWqSvPTjPHgMI8VWvZbFJADmPdzN1RHP1eGNaznqrqFuojPof9p/ZXzeBa/QU 6UuvVOl89YeM/8ZLsVLIunuFDZd8lhSSspFGAqxdBPw1QyacDsiZCbh7c+V1juhqnYig l3WQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="QOk58/19"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id u10si80717jat.85.2021.08.13.10.05.38; Fri, 13 Aug 2021 10:05:50 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="QOk58/19"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242311AbhHMPVC (ORCPT + 99 others); Fri, 13 Aug 2021 11:21:02 -0400 Received: from mail.kernel.org ([198.145.29.99]:54700 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242751AbhHMPQC (ORCPT ); Fri, 13 Aug 2021 11:16:02 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 5CA2461152; Fri, 13 Aug 2021 15:14:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1628867692; bh=W2Cbu42CZR1HVxw2ndsoeOYkX0plsn+4XbQGMzQpWVQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=QOk58/19ffHG4KAux6Bp7YP3eFvgSM8HBfNITpOtevhD49ktHi+8fkw5iPt4cPFTe fZ20wfjxwdZ/xN7Dm3iWWFrqaSQLGtC8NkayZQvMqNjCVy2B+vnAJrjFJsyYhS0KWy jXKPWlknnKZYpu9rgdX90tgd4nVNraUvuEhoHjNg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Hans de Goede , Sudip Mukherjee Subject: [PATCH 5.10 12/19] vboxsf: Make vboxsf_dir_create() return the handle for the created file Date: Fri, 13 Aug 2021 17:07:29 +0200 Message-Id: <20210813150523.032839314@linuxfoundation.org> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210813150522.623322501@linuxfoundation.org> References: <20210813150522.623322501@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Hans de Goede commit ab0c29687bc7a890d1a86ac376b0b0fd78b2d9b6 upstream Make vboxsf_dir_create() optionally return the vboxsf-handle for the created file. This is a preparation patch for adding atomic_open support. Fixes: 0fd169576648 ("fs: Add VirtualBox guest shared folder (vboxsf) support") Signed-off-by: Hans de Goede Signed-off-by: Sudip Mukherjee Signed-off-by: Greg Kroah-Hartman --- fs/vboxsf/dir.c | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) --- a/fs/vboxsf/dir.c +++ b/fs/vboxsf/dir.c @@ -253,7 +253,7 @@ static int vboxsf_dir_instantiate(struct } static int vboxsf_dir_create(struct inode *parent, struct dentry *dentry, - umode_t mode, bool is_dir, bool excl) + umode_t mode, bool is_dir, bool excl, u64 *handle_ret) { struct vboxsf_inode *sf_parent_i = VBOXSF_I(parent); struct vboxsf_sbi *sbi = VBOXSF_SBI(parent->i_sb); @@ -278,28 +278,32 @@ static int vboxsf_dir_create(struct inod if (params.result != SHFL_FILE_CREATED) return -EPERM; - vboxsf_close(sbi->root, params.handle); - err = vboxsf_dir_instantiate(parent, dentry, ¶ms.info); if (err) - return err; + goto out; /* parent directory access/change time changed */ sf_parent_i->force_restat = 1; - return 0; +out: + if (err == 0 && handle_ret) + *handle_ret = params.handle; + else + vboxsf_close(sbi->root, params.handle); + + return err; } static int vboxsf_dir_mkfile(struct inode *parent, struct dentry *dentry, umode_t mode, bool excl) { - return vboxsf_dir_create(parent, dentry, mode, false, excl); + return vboxsf_dir_create(parent, dentry, mode, false, excl, NULL); } static int vboxsf_dir_mkdir(struct inode *parent, struct dentry *dentry, umode_t mode) { - return vboxsf_dir_create(parent, dentry, mode, true, true); + return vboxsf_dir_create(parent, dentry, mode, true, true, NULL); } static int vboxsf_dir_unlink(struct inode *parent, struct dentry *dentry)