Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp336972pxa; Tue, 4 Aug 2020 06:54:50 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxHhZQyMSpEJPb63LXz5m4kIRLi2G/cd7+tkkhnrJZYjObmyAHZVOYWGqLRbhE614pTAtVG X-Received: by 2002:a17:906:8595:: with SMTP id v21mr3955006ejx.347.1596549290094; Tue, 04 Aug 2020 06:54:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1596549290; cv=none; d=google.com; s=arc-20160816; b=HF6mF5Hvs7lIfaknu+eS3UXphI9FgltXHtMuT2YHHvU3du3LSJ3+LTgSkohg6mubn+ kKLJrfv4Vh42DYRbchuI1FG5KTiA8DRmD9bgtjWvbdyYrjNbGhBkxgqcL7xCwffSLOWJ mmtG0ECCY5rwsVzs2XcYdpGn8GSIv96AzLQo43NFnwS9YagBgEwVnSImiIWmizZdMvyp d2K9plY5/rKIk6S3i+vZWHYeY/z1keoVpAJyYTyyTZpDG63XPnTNVkI5stfV14hz1XBI 5LGNEfFNTz1BJgih1jah74ebDQCwhn72qhjcDetC6gQMBS6gfxb2PASnwZvNiCWtJIqd BL5A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=Gjh1CQhNcX/dKpwghpqe5PsnWMgHIT7SFzJs24h1UQM=; b=HCa8/66ybHF9OAU1a0eggXBLHgfmkH2ra6UIEzdlrbCkZj97ukt9k3/+/+hvXcCZ5d WJ6sKBpUXSAcQ/aTN4L5LC2HUkYXGU2XCOVCqyKEt8OWBMcgnHA3rZt5XqXzSz6BTKLp zpqzmbp1GC5vtvCk/6EFL+Dtl2Z3vj50wY7m+gWn4UPXAbCkNg/dO778fWxcx2NWUevd YuXSm6OAT173M3KvGtclrjPdsed4Gb6/8LBp099sDhCTKcA9gLHPoUmQnCTNof2IXR2u vqmcJrIpKkfscIRrQV109+XnL+Jv/QyYlouxkO2kwEPS2aQiuuWYumjyJ/2swl8Q3KFy 8gVw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=MqpYAiWi; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id a20si3512379edj.133.2020.08.04.06.54.26; Tue, 04 Aug 2020 06:54: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=@google.com header.s=20161025 header.b=MqpYAiWi; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728493AbgHDNyT (ORCPT + 99 others); Tue, 4 Aug 2020 09:54:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51954 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728408AbgHDNyR (ORCPT ); Tue, 4 Aug 2020 09:54:17 -0400 Received: from mail-vk1-xa44.google.com (mail-vk1-xa44.google.com [IPv6:2607:f8b0:4864:20::a44]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AABB6C061756 for ; Tue, 4 Aug 2020 06:54:17 -0700 (PDT) Received: by mail-vk1-xa44.google.com with SMTP id o2so1275076vkn.9 for ; Tue, 04 Aug 2020 06:54:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=Gjh1CQhNcX/dKpwghpqe5PsnWMgHIT7SFzJs24h1UQM=; b=MqpYAiWijmvg7loVHczpUKtn2+LJz7S2aV+N438n2Y65/hPVYPyLQR3Af4s3W2Ukz5 gLYAov6l7shRm+JJpOMpNLndV0/ZN4ObOy7kmt1MItL+zU2Z+xVsuMjvEyJd2qOdyWo0 FylGqdCVn+1NMjtq4E5q0zRZFh8pRB+uxba1HCcuNm9M02q8JFldhPwgCaiZOYCWBq17 hVfSRFG/p6V6p2i8FPTcnBgv1pNvvWSi1HNczyO13FgS09NjRa2VVtLpmtPOcrBkTVBA UyvW53IFCMp5nvhUMLZR17cge+of0Ri0a1fQv4QKYnq9ADROB24CM2+wvliFp9MVw8OR sPIw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=Gjh1CQhNcX/dKpwghpqe5PsnWMgHIT7SFzJs24h1UQM=; b=pPvj9KBUgG0buFW/cgCF5iRKh+/VVBlIA0ObwWkIQ0rUOR1HDlLftLjm1fbQo8wnrF qApw1/IuSOj7tH33aQnU+UE8uxVWADoeKIdqIBgPxdWkvvUzVgEa1xJYeTn7RkSnDckd gr4QZIgubVZ1zzPH+apaNxFT339exYug5dmGHWDiUeIRlNjCmPHp7tg+ztiywZvHTEtZ vHUsY3sqPmOM/wA+WKwzs0opeW3auzhGMA4Agc3Re8OBSqcEipE+txV6Ntrbwak1wmZU X6YH71X/WHVtSRu7BH34yln4tP/HbqAtjgLffBmBCqfhPk/fcKkL/uSKkdXJt0fhRzG4 zrcQ== X-Gm-Message-State: AOAM532Rvzv7PLrGJ12JhVTYtVBb5+0DSVF2L8xTwkaSJff84Vd3fbzc ziGeW1QU6R9XdYBuXoXy4nrO5A== X-Received: by 2002:a1f:bd02:: with SMTP id n2mr14859615vkf.1.1596549256680; Tue, 04 Aug 2020 06:54:16 -0700 (PDT) Received: from google.com (182.71.196.35.bc.googleusercontent.com. [35.196.71.182]) by smtp.gmail.com with ESMTPSA id n62sm3130893vke.12.2020.08.04.06.54.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 04 Aug 2020 06:54:15 -0700 (PDT) Date: Tue, 4 Aug 2020 13:54:12 +0000 From: Kalesh Singh To: Joel Fernandes Cc: Jonathan Corbet , Sumit Semwal , Alexander Viro , Steven Rostedt , Ingo Molnar , "open list:DOCUMENTATION" , LKML , linux-media@vger.kernel.org, dri-devel@lists.freedesktop.org, linaro-mm-sig@lists.linaro.org, linux-fsdevel@vger.kernel.org, Suren Baghdasaryan , Hridya Valsaraju , Ioannis Ilkos , John Stultz , "Cc: Android Kernel" Subject: Re: [PATCH 1/2] fs: Add fd_install file operation Message-ID: <20200804135412.GA934259@google.com> References: <20200803144719.3184138-1-kaleshsingh@google.com> <20200803144719.3184138-2-kaleshsingh@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Aug 03, 2020 at 08:30:59PM -0400, Joel Fernandes wrote: > On Mon, Aug 3, 2020 at 10:47 AM 'Kalesh Singh' via kernel-team > wrote: > > > > Provides a per process hook for the acquisition of file descriptors, > > despite the method used to obtain the descriptor. > > > > Hi, > So apart from all of the comments received, I think it is hard to > understand what the problem is, what the front-end looks like etc. > Your commit message is 1 line only. > > I do remember some of the challenges discussed before, but it would > describe the problem in the commit message in detail and then discuss > why this solution is fit. Please read submitting-patches.rst > especially "2) Describe your changes". > > thanks, > > - Joel Thanks for the advice Joel :) > > > > Signed-off-by: Kalesh Singh > > --- > > Documentation/filesystems/vfs.rst | 5 +++++ > > fs/file.c | 3 +++ > > include/linux/fs.h | 1 + > > 3 files changed, 9 insertions(+) > > > > diff --git a/Documentation/filesystems/vfs.rst b/Documentation/filesystems/vfs.rst > > index ed17771c212b..95b30142c8d9 100644 > > --- a/Documentation/filesystems/vfs.rst > > +++ b/Documentation/filesystems/vfs.rst > > @@ -1123,6 +1123,11 @@ otherwise noted. > > ``fadvise`` > > possibly called by the fadvise64() system call. > > > > +``fd_install`` > > + called by the VFS when a file descriptor is installed in the > > + process's file descriptor table, regardless how the file descriptor > > + was acquired -- be it via the open syscall, received over IPC, etc. > > + > > Note that the file operations are implemented by the specific > > filesystem in which the inode resides. When opening a device node > > (character or block special) most filesystems will call special > > diff --git a/fs/file.c b/fs/file.c > > index abb8b7081d7a..f5db8622b851 100644 > > --- a/fs/file.c > > +++ b/fs/file.c > > @@ -616,6 +616,9 @@ void __fd_install(struct files_struct *files, unsigned int fd, > > void fd_install(unsigned int fd, struct file *file) > > { > > __fd_install(current->files, fd, file); > > + > > + if (file->f_op->fd_install) > > + file->f_op->fd_install(fd, file); > > } > > > > EXPORT_SYMBOL(fd_install); > > diff --git a/include/linux/fs.h b/include/linux/fs.h > > index f5abba86107d..b976fbe8c902 100644 > > --- a/include/linux/fs.h > > +++ b/include/linux/fs.h > > @@ -1864,6 +1864,7 @@ struct file_operations { > > struct file *file_out, loff_t pos_out, > > loff_t len, unsigned int remap_flags); > > int (*fadvise)(struct file *, loff_t, loff_t, int); > > + void (*fd_install)(int, struct file *); > > } __randomize_layout; > > > > struct inode_operations { > > -- > > 2.28.0.163.g6104cc2f0b6-goog > > > > -- > > To unsubscribe from this group and stop receiving emails from it, send an email to kernel-team+unsubscribe@android.com. > >