Received: by 2002:a05:6a10:1d13:0:0:0:0 with SMTP id pp19csp607082pxb; Mon, 16 Aug 2021 12:53:47 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzZroS7AAVF/ikYeXbOcWSxBe3NVzzOh1koZ0t1+NFFLsNm11PrdrROW/4oxdBGXm217fXC X-Received: by 2002:a5e:a81a:: with SMTP id c26mr453438ioa.15.1629143627362; Mon, 16 Aug 2021 12:53:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1629143627; cv=none; d=google.com; s=arc-20160816; b=UEAbz+H+X10Hrt+ltgH2IRomO1gz/DZFJCG6Y6bzR4+gLOavbslYh2mO2iZ8wVso9p DllFMjyl2NWOqtjzXLaQSVbxxnSAvmP/wHeU4su3VlJU4on6WZqSr+5fo7V7bdMP8Ss+ aw1LUBrjd+0YMSBL63qj/pyMbC3eehrA2kkyTvL8QpD9m6NMfwfB7oKrjDS+E2+Z945V 0qYALvtqrrC9lBfwecWEtXRqrgs2hyh59NjVeP0U1zDkSD1ay5pSxIgIy3SPsAXdOr3k yfc3TQBGSzGkDpvShSHNmzdWYfJEu/bgvWVz4hoZKaLcDjQtNkce4e9P0BRgcV3iSizm ZF2g== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=HXTa/VyECSSTBgPq2TU+rmvN898vFz2Xyhub0w4Arrg=; b=G/soWSmsvAe7q7Zg6171fg4LBtDQtIeD3K0wdJE7P4OgLpNi7BBX3IsEApkFPgrM5y +dJHk5Ba47Sb88Zu6PY6iy4JSVibeaf79tMqc3ScZpHxbP98oD2QnlUoQET9RBRyYWI+ qbACFmIKb0gUiPGqwr5l8RR7twsZJW+X+d5lKGEVK5uXqB/YLBvJ6IRIUUb79tU97HpC dq3SsTJckbDCT+dFjZY2aEdg3MWsYliUm50Sh4FDUswgQ0RdSoF5lA7qHMNTo6AcPohs luD6khRgyS/T/ePH3VBbV2xrCFcoOKKCV3xqcCAa9d3x3514j0A6msgTf5ihQEuLfSiz vWew== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=TLdn1ubO; 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=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id f16si158744ile.51.2021.08.16.12.53.35; Mon, 16 Aug 2021 12:53:47 -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=@redhat.com header.s=mimecast20190719 header.b=TLdn1ubO; 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=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231143AbhHPTwV (ORCPT + 99 others); Mon, 16 Aug 2021 15:52:21 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:53197 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230367AbhHPTwU (ORCPT ); Mon, 16 Aug 2021 15:52:20 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1629143508; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=HXTa/VyECSSTBgPq2TU+rmvN898vFz2Xyhub0w4Arrg=; b=TLdn1ubOR90fCWlq7e1ufGFlNDTDlw9McZHAx5j8Q/tXIriMXbRiSkMZyz0TZzLL6gnnvm 71554zyeuIm3x+qJ3s8UsywAza7i538HwR2JuKvPNgKIGoF0ssOQlmEizSUHsfz4IzSyWd EgOzOfqLjYEUPlmtVerJ38g2YU2e/jE= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-409-PwTvF9prMuyqvP7LVfHsqw-1; Mon, 16 Aug 2021 15:51:47 -0400 X-MC-Unique: PwTvF9prMuyqvP7LVfHsqw-1 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 178EB107ACF5; Mon, 16 Aug 2021 19:51:46 +0000 (UTC) Received: from t480s.redhat.com (unknown [10.39.192.85]) by smtp.corp.redhat.com (Postfix) with ESMTP id 6FFAE5C1D5; Mon, 16 Aug 2021 19:51:26 +0000 (UTC) From: David Hildenbrand To: linux-kernel@vger.kernel.org Cc: David Hildenbrand , Linus Torvalds , Andrew Morton , Thomas Gleixner , Ingo Molnar , Borislav Petkov , "H. Peter Anvin" , Alexander Viro , Alexey Dobriyan , Steven Rostedt , Peter Zijlstra , Arnaldo Carvalho de Melo , Mark Rutland , Alexander Shishkin , Jiri Olsa , Namhyung Kim , Petr Mladek , Sergey Senozhatsky , Andy Shevchenko , Rasmus Villemoes , Kees Cook , "Eric W. Biederman" , Greg Ungerer , Geert Uytterhoeven , Mike Rapoport , Vlastimil Babka , Vincenzo Frascino , Chinwen Chang , Catalin Marinas , "Matthew Wilcox (Oracle)" , Huang Ying , Jann Horn , Feng Tang , Kevin Brodsky , Michael Ellerman , Shawn Anastasio , Steven Price , Nicholas Piggin , Christian Brauner , Jens Axboe , Gabriel Krisman Bertazi , Peter Xu , Suren Baghdasaryan , Shakeel Butt , Marco Elver , Daniel Jordan , Nicolas Viennot , Thomas Cedeno , Michal Hocko , Miklos Szeredi , Chengguang Xu , =?UTF-8?q?Christian=20K=C3=B6nig?= , Florian Weimer , David Laight , linux-unionfs@vger.kernel.org, linux-api@vger.kernel.org, x86@kernel.org, linux-fsdevel@vger.kernel.org, linux-mm@kvack.org Subject: [PATCH v2 7/7] fs: update documentation of get_write_access() and friends Date: Mon, 16 Aug 2021 21:48:40 +0200 Message-Id: <20210816194840.42769-8-david@redhat.com> In-Reply-To: <20210816194840.42769-1-david@redhat.com> References: <20210816194840.42769-1-david@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org As VM_DENYWRITE does no longer exists, let's spring-clean the documentation of get_write_access() and friends. Acked-by: "Eric W. Biederman" Signed-off-by: David Hildenbrand --- include/linux/fs.h | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/include/linux/fs.h b/include/linux/fs.h index 640574294216..e0dc3e96ed72 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h @@ -3055,15 +3055,20 @@ static inline void file_end_write(struct file *file) } /* + * This is used for regular files where some users -- especially the + * currently executed binary in a process, previously handled via + * VM_DENYWRITE -- cannot handle concurrent write (and maybe mmap + * read-write shared) accesses. + * * get_write_access() gets write permission for a file. * put_write_access() releases this write permission. - * This is used for regular files. - * We cannot support write (and maybe mmap read-write shared) accesses and - * MAP_DENYWRITE mmappings simultaneously. The i_writecount field of an inode - * can have the following values: - * 0: no writers, no VM_DENYWRITE mappings - * < 0: (-i_writecount) vm_area_structs with VM_DENYWRITE set exist - * > 0: (i_writecount) users are writing to the file. + * deny_write_access() denies write access to a file. + * allow_write_access() re-enables write access to a file. + * + * The i_writecount field of an inode can have the following values: + * 0: no write access, no denied write access + * < 0: (-i_writecount) users that denied write access to the file. + * > 0: (i_writecount) users that have write access to the file. * * Normally we operate on that counter with atomic_{inc,dec} and it's safe * except for the cases where we don't hold i_writecount yet. Then we need to -- 2.31.1