Forum | Documentation | Website | Blog

Skip to content
Snippets Groups Projects
  1. Dec 24, 2023
  2. Jun 10, 2022
    • Linus Torvalds's avatar
      netfs: Further cleanups after struct netfs_inode wrapper introduced · e81fb419
      Linus Torvalds authored
      
      Change the signature of netfs helper functions to take a struct netfs_inode
      pointer rather than a struct inode pointer where appropriate, thereby
      relieving the need for the network filesystem to convert its internal inode
      format down to the VFS inode only for netfslib to bounce it back up.  For
      type safety, it's better not to do that (and it's less typing too).
      
      Give netfs_write_begin() an extra argument to pass in a pointer to the
      netfs_inode struct rather than deriving it internally from the file
      pointer.  Note that the ->write_begin() and ->write_end() ops are intended
      to be replaced in the future by netfslib code that manages this without the
      need to call in twice for each page.
      
      netfs_readpage() and similar are intended to be pointed at directly by the
      address_space_operations table, so must stick to the signature dictated by
      the function pointers there.
      
      Changes
      =======
      - Updated the kerneldoc comments and documentation [DH].
      
      Signed-off-by: default avatarDavid Howells <dhowells@redhat.com>
      cc: linux-cachefs@redhat.com
      Link: https://lore.kernel.org/r/CAHk-=wgkwKyNmNdKpQkqZ6DnmUL-x9hp0YBnUGjaPFEAdxDTbw@mail.gmail.com/
      e81fb419
  3. Jun 09, 2022
    • David Howells's avatar
      netfs: Fix gcc-12 warning by embedding vfs inode in netfs_i_context · 874c8ca1
      David Howells authored
      While randstruct was satisfied with using an open-coded "void *" offset
      cast for the netfs_i_context <-> inode casting, __builtin_object_size() as
      used by FORTIFY_SOURCE was not as easily fooled.  This was causing the
      following complaint[1] from gcc v12:
      
        In file included from include/linux/string.h:253,
                         from include/linux/ceph/ceph_debug.h:7,
                         from fs/ceph/inode.c:2:
        In function 'fortify_memset_chk',
            inlined from 'netfs_i_context_init' at include/linux/netfs.h:326:2,
            inlined from 'ceph_alloc_inode' at fs/ceph/inode.c:463:2:
        include/linux/fortify-string.h:242:25: warning: call to '__write_overflow_field' declared with attribute warning: detected write beyond size of field (1st parameter); maybe use struct_group()? [-Wattribute-warning]
          242 |                         __write_overflow_field(p_size_field, size);
              |                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      
      Fix this by embedding a struct inode into struct netfs_i_context (which
      should perhaps be renamed to struct netfs_inode).  The struct inode
      vfs_inode fields are then removed from the 9p, afs, ceph and cifs inode
      structs and vfs_inode is then simply changed to "netfs.inode" in those
      filesystems.
      
      Further, rename netfs_i_context to netfs_inode, get rid of the
      netfs_inode() function that converted a netfs_i_context pointer to an
      inode pointer (that can now be done with &ctx->inode) and rename the
      netfs_i_context() function to netfs_inode() (which is now a wrapper
      around container_of()).
      
      Most of the changes were done with:
      
        perl -p -i -e 's/vfs_inode/netfs.inode/'g \
              `git grep -l 'vfs_inode' -- fs/{9p,afs,ceph,cifs}/*.[ch]`
      
      Kees suggested doing it with a pair structure[2] and a special
      declarator to insert that into the network filesystem's inode
      wrapper[3], but I think it's cleaner to embed it - and then it doesn't
      matter if struct randomisation reorders things.
      
      Dave Chinner suggested using a filesystem-specific VFS_I() function in
      each filesystem to convert that filesystem's own inode wrapper struct
      into the VFS inode struct[4].
      
      Version #2:
       - Fix a couple of missed name changes due to a disabled cifs option.
       - Rename nfs_i_context to nfs_inode
       - Use "netfs" instead of "nic" as the member name in per-fs inode wrapper
         structs.
      
      [ This also undoes commit 507160f4 ("netfs: gcc-12: temporarily
        disable '-Wattribute-warning' for now") that is no longer needed ]
      
      Fixes: bc899ee1
      
       ("netfs: Add a netfs inode context")
      Reported-by: default avatarJeff Layton <jlayton@kernel.org>
      Signed-off-by: default avatarDavid Howells <dhowells@redhat.com>
      Reviewed-by: default avatarJeff Layton <jlayton@kernel.org>
      Reviewed-by: default avatarKees Cook <keescook@chromium.org>
      Reviewed-by: default avatarXiubo Li <xiubli@redhat.com>
      cc: Jonathan Corbet <corbet@lwn.net>
      cc: Eric Van Hensbergen <ericvh@gmail.com>
      cc: Latchesar Ionkov <lucho@ionkov.net>
      cc: Dominique Martinet <asmadeus@codewreck.org>
      cc: Christian Schoenebeck <linux_oss@crudebyte.com>
      cc: Marc Dionne <marc.dionne@auristor.com>
      cc: Ilya Dryomov <idryomov@gmail.com>
      cc: Steve French <smfrench@gmail.com>
      cc: William Kucharski <william.kucharski@oracle.com>
      cc: "Matthew Wilcox (Oracle)" <willy@infradead.org>
      cc: Dave Chinner <david@fromorbit.com>
      cc: linux-doc@vger.kernel.org
      cc: v9fs-developer@lists.sourceforge.net
      cc: linux-afs@lists.infradead.org
      cc: ceph-devel@vger.kernel.org
      cc: linux-cifs@vger.kernel.org
      cc: samba-technical@lists.samba.org
      cc: linux-fsdevel@vger.kernel.org
      cc: linux-hardening@vger.kernel.org
      Link: https://lore.kernel.org/r/d2ad3a3d7bdd794c6efb562d2f2b655fb67756b9.camel@kernel.org/ [1]
      Link: https://lore.kernel.org/r/20220517210230.864239-1-keescook@chromium.org/ [2]
      Link: https://lore.kernel.org/r/20220518202212.2322058-1-keescook@chromium.org/ [3]
      Link: https://lore.kernel.org/r/20220524101205.GI2306852@dread.disaster.area/ [4]
      Link: https://lore.kernel.org/r/165296786831.3591209.12111293034669289733.stgit@warthog.procyon.org.uk/ # v1
      Link: https://lore.kernel.org/r/165305805651.4094995.7763502506786714216.stgit@warthog.procyon.org.uk
      
       # v2
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      874c8ca1
  4. Mar 18, 2022
  5. Mar 15, 2022
  6. Jan 11, 2022
  7. Sep 02, 2021
  8. Apr 27, 2021
  9. Nov 27, 2019
  10. May 30, 2019
    • Thomas Gleixner's avatar
      treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 188 · 1f327613
      Thomas Gleixner authored
      
      Based on 1 normalized pattern(s):
      
        this program is free software you can redistribute it and or modify
        it under the terms of the gnu general public license version 2 as
        published by the free software foundation this program is
        distributed in the hope that it will be useful but without any
        warranty without even the implied warranty of merchantability or
        fitness for a particular purpose see the gnu general public license
        for more details you should have received a copy of the gnu general
        public license along with this program if not write to free software
        foundation 51 franklin street fifth floor boston ma 02111 1301 usa
      
      extracted by the scancode license scanner the SPDX license identifier
      
        GPL-2.0-only
      
      has been chosen to replace the boilerplate/reference in 27 file(s).
      
      Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
      Reviewed-by: default avatarRichard Fontana <rfontana@redhat.com>
      Reviewed-by: default avatarAlexios Zavras <alexios.zavras@inte...>
      1f327613
  11. Jun 01, 2016
    • Yan, Zheng's avatar
      ceph: improve fscache revalidation · f7f7e7a0
      Yan, Zheng authored
      
      There are several issues in fscache revalidation code.
      - In ceph_revalidate_work(), fscache_invalidate() is called when
        fscache_check_consistency() return 0. This is complete wrong
        because 0 means cache is valid.
      - Handle_cap_grant() calls ceph_queue_revalidate() if client
        already has CAP_FILE_CACHE. This code is confusing. Client
        should revalidate the cache each time it got CAP_FILE_CACHE
        anew.
      - In Handle_cap_grant(), fscache_invalidate() is called if MDS
        revokes CAP_FILE_CACHE. This is inconsistency with the case
        that inode get evicted. In the later case, the cache is not
        discarded. Client may use the cache when inode is reloaded.
      
      This patch moves the fscache revalidation into ceph_get_caps().
      Client revalidates the cache after it gets CAP_FILE_CACHE.
      i_rdcache_gen should keep constance while CAP_FILE_CACHE is
      used. If i_fscache_gen is not equal to i_rdcache_gen, client
      needs to check cache's consistency.
      
      Signed-off-by: default avatarYan, Zheng <zyan@redhat.com>
      f7f7e7a0
    • Yan, Zheng's avatar
      ceph: disable fscache when inode is opened for write · 46b59b2b
      Yan, Zheng authored
      
      All other filesystems do not add dirty pages to fscache. They all
      disable fscache when inode is opened for write. Only ceph adds
      dirty pages to fscache, but the code is buggy.
      
      Signed-off-by: default avatarYan, Zheng <zyan@redhat.com>
      46b59b2b
  12. Apr 02, 2014
  13. Dec 31, 2013
  14. Sep 06, 2013
    • Milosz Tanski's avatar
      ceph: trivial buildbot warnings fix · 971f0bde
      Milosz Tanski authored
      
      The linux-next build bot found a three of warnings, this addresses all of them.
      
       * non-ANSI function declaration of function 'ceph_fscache_register' and
         'ceph_fscache_unregister'
       * symbol 'ceph_cache_netfs' was not declared, now it's extern in the header.
       * warning: "pr_fmt" redefined
      
      Signed-off-by: default avatarMilosz Tanski <milosz@adfin.com>
      971f0bde
    • Milosz Tanski's avatar
      ceph: page still marked private_2 · d4d3aa38
      Milosz Tanski authored
      
      Previous patch that allowed us to cleanup most of the issues with pages marked
      as private_2 when calling ceph_readpages. However, there seams to be a case in
      the error case clean up in start read that still trigers this from time to
      time. I've only seen this one a couple times.
      
      BUG: Bad page state in process petabucket  pfn:335b82
      page:ffffea000cd6e080 count:0 mapcount:0 mapping:          (null) index:0x0
      page flags: 0x200000000001000(private_2)
      Call Trace:
       [<ffffffff81563442>] dump_stack+0x46/0x58
       [<ffffffff8112c7f7>] bad_page+0xc7/0x120
       [<ffffffff8112cd9e>] free_pages_prepare+0x10e/0x120
       [<ffffffff8112e580>] free_hot_cold_page+0x40/0x160
       [<ffffffff81132427>] __put_single_page+0x27/0x30
       [<ffffffff81132d95>] put_page+0x25/0x40
       [<ffffffffa02cb409>] ceph_readpages+0x2e9/0x6f0 [ceph]
       [<ffffffff811313cf>] __do_page_cache_readahead+0x1af/0x260
      
      Signed-off-by: default avatarMilosz Tanski <milosz@adfin.com>
      Signed-off-by: default avatarSage Weil <sage@inktank.com>
      d4d3aa38
    • Milosz Tanski's avatar
      ceph: clean PgPrivate2 on returning from readpages · 76be778b
      Milosz Tanski authored
      
      In some cases the ceph readapages code code bails without filling all the pages
      already marked by fscache. When we return back to readahead code this causes
      a BUG.
      
      Signed-off-by: default avatarMilosz Tanski <milosz@adfin.com>
      76be778b
    • Milosz Tanski's avatar
      ceph: use fscache as a local presisent cache · 99ccbd22
      Milosz Tanski authored
      
      Adding support for fscache to the Ceph filesystem. This would bring it to on
      par with some of the other network filesystems in Linux (like NFS, AFS, etc...)
      
      In order to mount the filesystem with fscache the 'fsc' mount option must be
      passed.
      
      Signed-off-by: default avatarMilosz Tanski <milosz@adfin.com>
      Signed-off-by: default avatarSage Weil <sage@inktank.com>
      99ccbd22