Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp2953520imm; Thu, 24 May 2018 19:48:15 -0700 (PDT) X-Google-Smtp-Source: AB8JxZoi8aAxzfOFB1FLq+DY/ULUf8T1QcgZCZvRcdYXX/WCQ/JbZmOshjZRNOrKnVMHLpXNrJ+u X-Received: by 2002:a17:902:b087:: with SMTP id p7-v6mr612447plr.227.1527216495519; Thu, 24 May 2018 19:48:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527216495; cv=none; d=google.com; s=arc-20160816; b=sfCxbS+rxp4uATyGyGQK6+oYOIwl1zj/oCNrr+LuS6lok2QmLMZB+StX+DtQJbWL8b 4KZsoqVPamNJGh287YPBNNb7ZLh+w3o92WDQz9jsS/w+CUYfgZbpqxEyRtr6zY+CGNA6 iN6c15/w6DiS/IDfKhU2Iz/FTPH01a1Dw8GkrIVCFcegZfAeGwO4F6bkfwb8WbPgvzJL 2UUvd0FLKg1Utmt+jdGYLdgc6BwjTDLyJ1rEsfoc2QBwujHSYioMLonWlEtw3T4pdqMo uB+9d13nOQHXdkZ/ccKCYwHyu/ZT1ns+Ei+wdV4srxevk3VEF26l41DD63GjFAIHZsue ktKw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:cc:to:from :subject:organization:arc-authentication-results; bh=8gbNXAR4zKC1GHrcIRrBdHwpK6JhRVZsFc4sSMGP/0o=; b=pICv7qmkAj+Yc+db/EW7tjXH9KVhk2ughPZAroZ6VJRsvKtUnrg334TiO4UIfmFEIB wg9QdnOLx98HeUc/wKVbSkN+eZym+/lbIla3wgL+WJf/EAgLU+FyOwVLUuEBWdY2bHbH Isscs2YkZp9klyEkQKXRg4y7IzPyGTP+1iUYQygtMIMi/aAaDO2K3JhMNjvNwbrSmrOF H4kmn7o4pDmMAJq2A3RUYdOh2ARVFbkOFlCOkNuMwN8zC07lZ+p9R6rCoSavR6oDn5+q t336OkMNt8+5kXnOp9PA94vzBYpTME1waVLAi66cvXG1xp1m6rLvkhKQ4XcICq4AaRli nRgA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id n125-v6si22603186pfn.352.2018.05.24.19.48.01; Thu, 24 May 2018 19:48:15 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1161635AbeEYAHj (ORCPT + 99 others); Thu, 24 May 2018 20:07:39 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:60478 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1161628AbeEYAHf (ORCPT ); Thu, 24 May 2018 20:07:35 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 33FA340267BF; Fri, 25 May 2018 00:07:35 +0000 (UTC) Received: from warthog.procyon.org.uk (ovpn-120-255.rdu2.redhat.com [10.10.120.255]) by smtp.corp.redhat.com (Postfix) with ESMTP id 89F302026E0E; Fri, 25 May 2018 00:07:34 +0000 (UTC) Organization: Red Hat UK Ltd. Registered Address: Red Hat UK Ltd, Amberley Place, 107-111 Peascod Street, Windsor, Berkshire, SI4 1TE, United Kingdom. Registered in England and Wales under Company Registration No. 3798903 Subject: [PATCH 20/32] vfs: Make close() unmount the attached mount if so flagged [ver #8] From: David Howells To: viro@zeniv.linux.org.uk Cc: dhowells@redhat.com, linux-fsdevel@vger.kernel.org, linux-afs@lists.infradead.org, linux-kernel@vger.kernel.org Date: Fri, 25 May 2018 01:07:34 +0100 Message-ID: <152720685405.9073.17445116582570028610.stgit@warthog.procyon.org.uk> In-Reply-To: <152720672288.9073.9868393448836301272.stgit@warthog.procyon.org.uk> References: <152720672288.9073.9868393448836301272.stgit@warthog.procyon.org.uk> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 2.78 on 10.11.54.4 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.6]); Fri, 25 May 2018 00:07:35 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.6]); Fri, 25 May 2018 00:07:35 +0000 (UTC) for IP:'10.11.54.4' DOMAIN:'int-mx04.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'dhowells@redhat.com' RCPT:'' Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --- fs/file_table.c | 4 ++++ include/linux/fs.h | 4 +++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/fs/file_table.c b/fs/file_table.c index 7ec0b3e5f05d..dbbcc563748a 100644 --- a/fs/file_table.c +++ b/fs/file_table.c @@ -30,6 +30,7 @@ #include #include "internal.h" +#include "mount.h" /* sysctl tunables... */ struct files_stat_struct files_stat = { @@ -200,6 +201,9 @@ static void __fput(struct file *file) eventpoll_release(file); locks_remove_file(file); + if (unlikely(file->f_mode & FMODE_NEED_UNMOUNT)) + __detach_mounts(dentry); + ima_file_free(file); if (unlikely(file->f_flags & FASYNC)) { if (file->f_op->fasync) diff --git a/include/linux/fs.h b/include/linux/fs.h index e771803cc8dc..ba571c18e236 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h @@ -152,7 +152,9 @@ typedef int (dio_iodone_t)(struct kiocb *iocb, loff_t offset, #define FMODE_NONOTIFY ((__force fmode_t)0x4000000) /* File is capable of returning -EAGAIN if I/O will block */ -#define FMODE_NOWAIT ((__force fmode_t)0x8000000) +#define FMODE_NOWAIT ((__force fmode_t)0x8000000) +/* File represents mount that needs unmounting */ +#define FMODE_NEED_UNMOUNT ((__force fmode_t)0x10000000) /* * Flag for rw_copy_check_uvector and compat_rw_copy_check_uvector