From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-17.2 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id D4D12C12002 for ; Wed, 21 Jul 2021 16:20:49 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id B8B9460FE9 for ; Wed, 21 Jul 2021 16:20:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236116AbhGUPkL (ORCPT ); Wed, 21 Jul 2021 11:40:11 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:27843 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235984AbhGUPkK (ORCPT ); Wed, 21 Jul 2021 11:40:10 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1626884446; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=YkZTscC6KpmV7ZPZQ/arpngaCqGBZg3nbQ0knfcsigA=; b=OoNHUArlPziuidJkqum5NZbzWl39kZjrq4df41R5oo6znE6t+yLYc7yQp+RG/+GR/O3JGL i4A+KrgqRY9y6V+MOcv+m5i9kIoMjtMX0RYriMvGWgiNuPci8UQwpf51MkFl21mJgESsH4 ob8TyMIRz1KtdFpJc6sqena2XP/IT7o= Received: from mail-qv1-f72.google.com (mail-qv1-f72.google.com [209.85.219.72]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-206-fMVdg6OuPmGDREBi4CU9gg-1; Wed, 21 Jul 2021 12:20:44 -0400 X-MC-Unique: fMVdg6OuPmGDREBi4CU9gg-1 Received: by mail-qv1-f72.google.com with SMTP id ca6-20020ad456060000b02902ea7953f97fso1850692qvb.22 for ; Wed, 21 Jul 2021 09:20:44 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:message-id:subject:from:to:cc:date:in-reply-to :references:user-agent:mime-version:content-transfer-encoding; bh=YkZTscC6KpmV7ZPZQ/arpngaCqGBZg3nbQ0knfcsigA=; b=m+1KXL2l4R6BVZZARgG1eWydDx2VKypzeg60/Lac7GFn1+c2iWnusGPNhVoUk3TnIs vi9Cr//Qs+zBDXxrLUmCoOa5Xj1pdUWPHH+Y2uhX42+uoesQ2/K8gzWzsnRYMY40tAUc X5Q8lwmOeFpe9OGo0vViHbRKJkeB7vi8zEv9pS4I3MmzTd4mgGnYQ6RhYMERPSCjU9B8 knd+1sFq1wbh88rIKzXl5enDYcVZtIEYfYUiK0uSr3zVSjIsurOB4G0YuNMLRvfojy4J Bl65doN1u4T5oxmOrzvKjlsYG3RbVec8qDXo3+7ef4IqJfMvxp8eOS2VsLotp1jkU1pf EYIg== X-Gm-Message-State: AOAM530dbxc9V6M7UEqB2Z4/oC/SFd67yA7h6YWvkxMyCviRt3B+dEam mdd0i2LKi8stbwFOsF7+Noixa0yHymAHD8XaGxiI/CPEp3jMDcN8Ctzk9MwKROa8Ed3OmKEDFnv J+2yKi6zbquYLh49327PTSg== X-Received: by 2002:a0c:a223:: with SMTP id f32mr37104023qva.8.1626884444602; Wed, 21 Jul 2021 09:20:44 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw+t6fxG/ixd7o7dlSLuaUhbdIrVbCJpvX027HWNZq9vT5wDnkVq2oxjwvDHG0JV/G1ddMkig== X-Received: by 2002:a0c:a223:: with SMTP id f32mr37103999qva.8.1626884444411; Wed, 21 Jul 2021 09:20:44 -0700 (PDT) Received: from [192.168.1.3] (68-20-15-154.lightspeed.rlghnc.sbcglobal.net. [68.20.15.154]) by smtp.gmail.com with ESMTPSA id i4sm9475118qka.130.2021.07.21.09.20.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 21 Jul 2021 09:20:43 -0700 (PDT) Message-ID: <35ecb577315f486f1636b2316c2051ad004f6f7b.camel@redhat.com> Subject: Re: [RFC PATCH 01/12] afs: Sort out symlink reading From: Jeff Layton To: David Howells , linux-fsdevel@vger.kernel.org Cc: "Matthew Wilcox (Oracle)" , Anna Schumaker , Steve French , Dominique Martinet , Mike Marshall , David Wysochanski , Shyam Prasad N , Miklos Szeredi , Linus Torvalds , linux-cachefs@redhat.com, linux-afs@lists.infradead.org, linux-nfs@vger.kernel.org, linux-cifs@vger.kernel.org, ceph-devel@vger.kernel.org, v9fs-developer@lists.sourceforge.net, devel@lists.orangefs.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org Date: Wed, 21 Jul 2021 12:20:42 -0400 In-Reply-To: <162687508008.276387.6418924257569297305.stgit@warthog.procyon.org.uk> References: <162687506932.276387.14456718890524355509.stgit@warthog.procyon.org.uk> <162687508008.276387.6418924257569297305.stgit@warthog.procyon.org.uk> Content-Type: text/plain; charset="ISO-8859-15" User-Agent: Evolution 3.40.3 (3.40.3-1.fc34) MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: ceph-devel@vger.kernel.org On Wed, 2021-07-21 at 14:44 +0100, David Howells wrote: > afs_readpage() doesn't get a file pointer when called for a symlink, so > separate it from regular file pointer handling. > > Signed-off-by: David Howells > --- > > fs/afs/file.c | 14 +++++++++----- > fs/afs/inode.c | 6 +++--- > fs/afs/internal.h | 3 ++- > 3 files changed, 14 insertions(+), 9 deletions(-) > > diff --git a/fs/afs/file.c b/fs/afs/file.c > index ca0d993add65..c9c21ad0e7c9 100644 > --- a/fs/afs/file.c > +++ b/fs/afs/file.c > @@ -19,6 +19,7 @@ > > static int afs_file_mmap(struct file *file, struct vm_area_struct *vma); > static int afs_readpage(struct file *file, struct page *page); > +static int afs_symlink_readpage(struct file *file, struct page *page); > static void afs_invalidatepage(struct page *page, unsigned int offset, > unsigned int length); > static int afs_releasepage(struct page *page, gfp_t gfp_flags); > @@ -46,7 +47,7 @@ const struct inode_operations afs_file_inode_operations = { > .permission = afs_permission, > }; > > -const struct address_space_operations afs_fs_aops = { > +const struct address_space_operations afs_file_aops = { > .readpage = afs_readpage, > .readahead = afs_readahead, > .set_page_dirty = afs_set_page_dirty, > @@ -60,6 +61,12 @@ const struct address_space_operations afs_fs_aops = { > .writepages = afs_writepages, > }; > > +const struct address_space_operations afs_symlink_aops = { > + .readpage = afs_symlink_readpage, > + .releasepage = afs_releasepage, > + .invalidatepage = afs_invalidatepage, > +}; > + > static const struct vm_operations_struct afs_vm_ops = { > .fault = filemap_fault, > .map_pages = filemap_map_pages, > @@ -321,7 +328,7 @@ static void afs_req_issue_op(struct netfs_read_subrequest *subreq) > afs_fetch_data(fsreq->vnode, fsreq); > } > > -static int afs_symlink_readpage(struct page *page) > +static int afs_symlink_readpage(struct file *file, struct page *page) > { > struct afs_vnode *vnode = AFS_FS_I(page->mapping->host); > struct afs_read *fsreq; I wonder...would you be better served here by not using page_readlink for symlinks and instead use simple_get_link and roll your own readlink operation. It seems a bit more direct, and AFS seems to be the only caller of page_readlink. > @@ -386,9 +393,6 @@ const struct netfs_read_request_ops afs_req_ops = { > > static int afs_readpage(struct file *file, struct page *page) > { > - if (!file) > - return afs_symlink_readpage(page); > - > return netfs_readpage(file, page, &afs_req_ops, NULL); > } > > diff --git a/fs/afs/inode.c b/fs/afs/inode.c > index bef6f5ccfb09..cf7b66957c6f 100644 > --- a/fs/afs/inode.c > +++ b/fs/afs/inode.c > @@ -105,7 +105,7 @@ static int afs_inode_init_from_status(struct afs_operation *op, > inode->i_mode = S_IFREG | (status->mode & S_IALLUGO); > inode->i_op = &afs_file_inode_operations; > inode->i_fop = &afs_file_operations; > - inode->i_mapping->a_ops = &afs_fs_aops; > + inode->i_mapping->a_ops = &afs_file_aops; > break; > case AFS_FTYPE_DIR: > inode->i_mode = S_IFDIR | (status->mode & S_IALLUGO); > @@ -123,11 +123,11 @@ static int afs_inode_init_from_status(struct afs_operation *op, > inode->i_mode = S_IFDIR | 0555; > inode->i_op = &afs_mntpt_inode_operations; > inode->i_fop = &afs_mntpt_file_operations; > - inode->i_mapping->a_ops = &afs_fs_aops; > + inode->i_mapping->a_ops = &afs_symlink_aops; > } else { > inode->i_mode = S_IFLNK | status->mode; > inode->i_op = &afs_symlink_inode_operations; > - inode->i_mapping->a_ops = &afs_fs_aops; > + inode->i_mapping->a_ops = &afs_symlink_aops; > } > inode_nohighmem(inode); > break; > diff --git a/fs/afs/internal.h b/fs/afs/internal.h > index 791cf02e5696..ccdde00ada8a 100644 > --- a/fs/afs/internal.h > +++ b/fs/afs/internal.h > @@ -1050,7 +1050,8 @@ extern void afs_dynroot_depopulate(struct super_block *); > /* > * file.c > */ > -extern const struct address_space_operations afs_fs_aops; > +extern const struct address_space_operations afs_file_aops; > +extern const struct address_space_operations afs_symlink_aops; > extern const struct inode_operations afs_file_inode_operations; > extern const struct file_operations afs_file_operations; > extern const struct netfs_read_request_ops afs_req_ops; > > Regardless, this is more reasonable than what's there now. Reviewed-by: Jeff Layton