1. 18 11月, 2017 1 次提交
    • T
      NFSv4.1: Fix up replays of interrupted requests · 3be0f80b
      Trond Myklebust 提交于
      If the previous request on a slot was interrupted before it was
      processed by the server, then our slot sequence number may be out of whack,
      and so we try the next operation using the old sequence number.
      
      The problem with this, is that not all servers check to see that the
      client is replaying the same operations as previously when they decide
      to go to the replay cache, and so instead of the expected error of
      NFS4ERR_SEQ_FALSE_RETRY, we get a replay of the old reply, which could
      (if the operations match up) be mistaken by the client for a new reply.
      
      To fix this, we attempt to send a COMPOUND containing only the SEQUENCE op
      in order to resync our slot sequence number.
      
      Cc: Olga Kornievskaia <olga.kornievskaia@gmail.com>
      [olga.kornievskaia@gmail.com: fix an Oops]
      Signed-off-by: NTrond Myklebust <trond.myklebust@primarydata.com>
      Signed-off-by: NAnna Schumaker <Anna.Schumaker@Netapp.com>
      3be0f80b
  2. 17 10月, 2017 4 次提交
    • N
      NFS: remove special-case revalidate in nfs_opendir() · 1fea73ac
      NeilBrown 提交于
      Commit f5a73672 ("NFS: allow close-to-open cache semantics to
      apply to root of NFS filesystem") added a call to
      __nfs_revalidate_inode() to nfs_opendir to as the lookup
      process wouldn't reliable do this.
      
      Subsequent commit a3fbbde7 ("VFS: we need to set LOOKUP_JUMPED
      on mountpoint crossing") make this unnecessary.  So remove the
      unnecessary code.
      Signed-off-by: NNeilBrown <neilb@suse.com>
      Signed-off-by: NAnna Schumaker <Anna.Schumaker@Netapp.com>
      1fea73ac
    • N
      NFS: revalidate "." etc correctly on "open". · b688741c
      NeilBrown 提交于
      For correct close-to-open semantics, NFS must validate
      the change attribute of a directory (or file) on open.
      
      Since commit ecf3d1f1 ("vfs: kill FS_REVAL_DOT by adding a
      d_weak_revalidate dentry op"), open() of "." or a path ending ".." is
      not revalidated reliably (except when that direct is a mount point).
      
      Prior to that commit, "." was revalidated using nfs_lookup_revalidate()
      which checks the LOOKUP_OPEN flag and forces revalidation if the flag is
      set.
      Since that commit, nfs_weak_revalidate() is used for NFSv3 (which
      ignores the flags) and nothing is used for NFSv4.
      
      This is fixed by using nfs_lookup_verify_inode() in
      nfs_weak_revalidate().  This does the revalidation exactly when needed.
      Also, add a definition of .d_weak_revalidate for NFSv4.
      
      The incorrect behavior is easily demonstrated by running "echo *" in
      some non-mountpoint NFS directory while watching network traffic.
      Without this patch, "echo *" sometimes doesn't produce any traffic.
      With the patch it always does.
      
      Fixes: ecf3d1f1 ("vfs: kill FS_REVAL_DOT by adding a d_weak_revalidate dentry op")
      cc: stable@vger.kernel.org (3.9+)
      Signed-off-by: NNeilBrown <neilb@suse.com>
      Signed-off-by: NAnna Schumaker <Anna.Schumaker@Netapp.com>
      b688741c
    • A
      NFS: Don't compare apples to elephants to determine access bits · 1750d929
      Anna Schumaker 提交于
      The NFS_ACCESS_* flags aren't a 1:1 mapping to the MAY_* flags, so
      checking for MAY_WHATEVER might have surprising results in
      nfs*_proc_access().  Let's simplify this check when determining which
      bits to ask for, and do it in a generic place instead of copying code
      for each NFS version.
      Signed-off-by: NAnna Schumaker <Anna.Schumaker@Netapp.com>
      1750d929
    • A
      NFS: Create NFS_ACCESS_* flags · 3c181827
      Anna Schumaker 提交于
      Passing the NFS v4 flags into the v3 code seems weird to me, even if
      they are defined to the same values.  This patch adds in generic flags
      to help me feel better
      Signed-off-by: NAnna Schumaker <Anna.Schumaker@Netapp.com>
      3c181827
  3. 14 10月, 2017 2 次提交
  4. 12 10月, 2017 7 次提交
  5. 11 10月, 2017 1 次提交
  6. 10 10月, 2017 1 次提交
    • J
      quota: Generate warnings for DQUOT_SPACE_NOFAIL allocations · ac3d7939
      Jan Kara 提交于
      Eryu has reported that since commit 7b9ca4c6 "quota: Reduce
      contention on dq_data_lock" test generic/233 occasionally fails. This is
      caused by the fact that since that commit we don't generate warning and
      set grace time for quota allocations that have DQUOT_SPACE_NOFAIL set
      (these are for example some metadata allocations in ext4). We need these
      allocations to behave regularly wrt warning generation and grace time
      setting so fix the code to return to the original behavior.
      Reported-and-tested-by: NEryu Guan <eguan@redhat.com>
      CC: stable@vger.kernel.org
      Fixes: 7b9ca4c6Signed-off-by: NJan Kara <jack@suse.cz>
      ac3d7939
  7. 06 10月, 2017 1 次提交
    • E
      nfsd4: define nfsd4_secinfo_no_name_release() · ec572b9e
      Eryu Guan 提交于
      Commit 34b1744c ("nfsd4: define ->op_release for compound ops")
      defined a couple ->op_release functions and run them if necessary.
      
      But there's a problem with that is that it reused
      nfsd4_secinfo_release() as the op_release of OP_SECINFO_NO_NAME, and
      caused a leak on struct nfsd4_secinfo_no_name in
      nfsd4_encode_secinfo_no_name(), because there's no .si_exp field in
      struct nfsd4_secinfo_no_name.
      
      I found this because I was unable to umount an ext4 partition after
      exporting it via NFS & run fsstress on the nfs mount. A simplified
      reproducer would be:
      
       # mount a local-fs device at /mnt/test, and export it via NFS with
       # fsid=0 export option (this is required)
       mount /dev/sda5 /mnt/test
       echo "/mnt/test *(rw,no_root_squash,fsid=0)" >> /etc/exports
       service nfs restart
      
       # locally mount the nfs export with all default, note that I have
       # nfsv4.1 configured as the default nfs version, because of the
       # fsid export option, v4 mount would fail and fall back to v3
       mount localhost:/mnt/test /mnt/nfs
      
       # try to umount the underlying device, but got EBUSY
       umount /mnt/nfs
       service nfs stop
       umount /mnt/test <=== EBUSY here
      
      Fixed it by defining a separate nfsd4_secinfo_no_name_release()
      function as the op_release method of OP_SECINFO_NO_NAME that
      releases the correct nfsd4_secinfo_no_name structure.
      
      Fixes: 34b1744c ("nfsd4: define ->op_release for compound ops")
      Signed-off-by: NEryu Guan <eguan@redhat.com>
      Signed-off-by: NJ. Bruce Fields <bfields@redhat.com>
      ec572b9e
  8. 05 10月, 2017 7 次提交
  9. 04 10月, 2017 12 次提交
  10. 03 10月, 2017 1 次提交
    • C
      f2fs: fix potential panic during fstrim · 638164a2
      Chao Yu 提交于
      As Ju Hyung Park reported:
      
      "When 'fstrim' is called for manual trim, a BUG() can be triggered
      randomly with this patch.
      
      I'm seeing this issue on both x86 Desktop and arm64 Android phone.
      
      On x86 Desktop, this was caused during Ubuntu boot-up. I have a
      cronjob installed which calls 'fstrim -v /' during boot. On arm64
      Android, this was caused during GC looping with 1ms gc_min_sleep_time
      & gc_max_sleep_time."
      
      Root cause of this issue is that f2fs_wait_discard_bios can only be
      used by f2fs_put_super, because during put_super there must be no
      other referrers, so it can ignore discard entry's reference count
      when removing the entry, otherwise in other caller we will hit bug_on
      in __remove_discard_cmd as there may be other issuer added reference
      count in discard entry.
      
      Thread A				Thread B
      					- issue_discard_thread
      - f2fs_ioc_fitrim
       - f2fs_trim_fs
        - f2fs_wait_discard_bios
         - __issue_discard_cmd
          - __submit_discard_cmd
      					 - __wait_discard_cmd
      					  - dc->ref++
      					  - __wait_one_discard_bio
         - __wait_discard_cmd
          - __remove_discard_cmd
           - f2fs_bug_on(sbi, dc->ref)
      
      Fixes: 969d1b18Reported-by: NJu Hyung Park <qkrwngud825@gmail.com>
      Signed-off-by: NChao Yu <yuchao0@huawei.com>
      Signed-off-by: NJaegeuk Kim <jaegeuk@kernel.org>
      638164a2
  11. 02 10月, 2017 3 次提交
    • Y
      ceph: fix __choose_mds() for LSSNAP request · 38f340cc
      Yan, Zheng 提交于
      previous commit 5d37ca14 "ceph: send LSSNAP request to auth mds
      of directory inode" is buggy. It makes __choose_mds() choose mds
      base on hash of '.snap' dentry.
      Signed-off-by: N"Yan, Zheng" <zyan@redhat.com>
      Signed-off-by: NIlya Dryomov <idryomov@gmail.com>
      38f340cc
    • Y
      ceph: properly queue cap snap for newly created snap realm · 9f4057fc
      Yan, Zheng 提交于
      commit 3ae0bebc "ceph: queue cap snap only when snap realm's
      context changes" introduced a regression: we may not call
      queue_realm_cap_snaps() for newly created snap realm. This
      regression allows unflushed snapshot data to be overwritten.
      
      Link: http://tracker.ceph.com/issues/21483Signed-off-by: N"Yan, Zheng" <zyan@redhat.com>
      Signed-off-by: NIlya Dryomov <idryomov@gmail.com>
      9f4057fc
    • S
      nfs/filelayout: fix oops when freeing filelayout segment · 0a47df11
      Scott Mayhew 提交于
      Check for a NULL dsaddr in filelayout_free_lseg() before calling
      nfs4_fl_put_deviceid().  This fixes the following oops:
      
      [ 1967.645207] BUG: unable to handle kernel NULL pointer dereference at 0000000000000030
      [ 1967.646010] IP: [<ffffffffc06d6aea>] nfs4_put_deviceid_node+0xa/0x90 [nfsv4]
      [ 1967.646010] PGD c08bc067 PUD 915d3067 PMD 0
      [ 1967.753036] Oops: 0000 [#1] SMP
      [ 1967.753036] Modules linked in: nfs_layout_nfsv41_files ext4 mbcache jbd2 loop rpcsec_gss_krb5 nfsv4 dns_resolver nfs fscache amd64_edac_mod ipmi_ssif edac_mce_amd edac_core kvm_amd sg kvm ipmi_si ipmi_devintf irqbypass pcspkr k8temp ipmi_msghandler i2c_piix4 shpchp nfsd auth_rpcgss nfs_acl lockd grace sunrpc ip_tables xfs libcrc32c sd_mod crc_t10dif crct10dif_generic crct10dif_common amdkfd amd_iommu_v2 radeon i2c_algo_bit drm_kms_helper syscopyarea sysfillrect sysimgblt fb_sys_fops mptsas ttm scsi_transport_sas mptscsih drm mptbase serio_raw i2c_core bnx2 dm_mirror dm_region_hash dm_log dm_mod
      [ 1967.790031] CPU: 2 PID: 1370 Comm: ls Not tainted 3.10.0-709.el7.test.bz1463784.x86_64 #1
      [ 1967.790031] Hardware name: IBM BladeCenter LS21 -[7971AC1]-/Server Blade, BIOS -[BAE155AUS-1.10]- 06/03/2009
      [ 1967.790031] task: ffff8800c42a3f40 ti: ffff8800c4064000 task.ti: ffff8800c4064000
      [ 1967.790031] RIP: 0010:[<ffffffffc06d6aea>]  [<ffffffffc06d6aea>] nfs4_put_deviceid_node+0xa/0x90 [nfsv4]
      [ 1967.790031] RSP: 0000:ffff8800c4067978  EFLAGS: 00010246
      [ 1967.790031] RAX: ffffffffc062f000 RBX: ffff8801d468a540 RCX: dead000000000200
      [ 1967.790031] RDX: ffff8800c40679f8 RSI: ffff8800c4067a0c RDI: 0000000000000000
      [ 1967.790031] RBP: ffff8800c4067980 R08: ffff8801d468a540 R09: 0000000000000000
      [ 1967.790031] R10: 0000000000000000 R11: ffffffffffffffff R12: ffff8801d468a540
      [ 1967.790031] R13: ffff8800c40679f8 R14: ffff8801d5645300 R15: ffff880126f15ff0
      [ 1967.790031] FS:  00007f11053c9800(0000) GS:ffff88012bd00000(0000) knlGS:0000000000000000
      [ 1967.790031] CS:  0010 DS: 0000 ES: 0000 CR0: 000000008005003b
      [ 1967.790031] CR2: 0000000000000030 CR3: 0000000094b55000 CR4: 00000000000007e0
      [ 1967.790031] Stack:
      [ 1967.790031]  ffff8801d468a540 ffff8800c4067990 ffffffffc062d2fe ffff8800c40679b0
      [ 1967.790031]  ffffffffc062b5b4 ffff8800c40679f8 ffff8801d468a540 ffff8800c40679d8
      [ 1967.790031]  ffffffffc06d39af ffff8800c40679f8 ffff880126f16078 0000000000000001
      [ 1967.790031] Call Trace:
      [ 1967.790031]  [<ffffffffc062d2fe>] nfs4_fl_put_deviceid+0xe/0x10 [nfs_layout_nfsv41_files]
      [ 1967.790031]  [<ffffffffc062b5b4>] filelayout_free_lseg+0x24/0x90 [nfs_layout_nfsv41_files]
      [ 1967.790031]  [<ffffffffc06d39af>] pnfs_free_lseg_list+0x5f/0x80 [nfsv4]
      [ 1967.790031]  [<ffffffffc06d5a67>] _pnfs_return_layout+0x157/0x270 [nfsv4]
      [ 1967.790031]  [<ffffffffc06c17dd>] nfs4_evict_inode+0x4d/0x70 [nfsv4]
      [ 1967.790031]  [<ffffffff8121de19>] evict+0xa9/0x180
      [ 1967.790031]  [<ffffffff8121e729>] iput+0xf9/0x190
      [ 1967.790031]  [<ffffffffc0652cea>] nfs_dentry_iput+0x3a/0x50 [nfs]
      [ 1967.790031]  [<ffffffff8121ab4f>] shrink_dentry_list+0x20f/0x490
      [ 1967.790031]  [<ffffffff8121b018>] d_invalidate+0xd8/0x150
      [ 1967.790031]  [<ffffffffc065446b>] nfs_readdir_page_filler+0x40b/0x600 [nfs]
      [ 1967.790031]  [<ffffffffc0654bbd>] nfs_readdir_xdr_to_array+0x20d/0x3b0 [nfs]
      [ 1967.790031]  [<ffffffff811f3482>] ? __mem_cgroup_commit_charge+0xe2/0x2f0
      [ 1967.790031]  [<ffffffff81183208>] ? __add_to_page_cache_locked+0x48/0x170
      [ 1967.790031]  [<ffffffffc0654d60>] ? nfs_readdir_xdr_to_array+0x3b0/0x3b0 [nfs]
      [ 1967.790031]  [<ffffffffc0654d82>] nfs_readdir_filler+0x22/0x90 [nfs]
      [ 1967.790031]  [<ffffffff8118351f>] do_read_cache_page+0x7f/0x190
      [ 1967.790031]  [<ffffffff81215d30>] ? fillonedir+0xe0/0xe0
      [ 1967.790031]  [<ffffffff8118366c>] read_cache_page+0x1c/0x30
      [ 1967.790031]  [<ffffffffc0654f9b>] nfs_readdir+0x1ab/0x6b0 [nfs]
      [ 1967.790031]  [<ffffffffc06bd1c0>] ? nfs4_xdr_dec_layoutget+0x270/0x270 [nfsv4]
      [ 1967.790031]  [<ffffffff81215d30>] ? fillonedir+0xe0/0xe0
      [ 1967.790031]  [<ffffffff81215c20>] vfs_readdir+0xb0/0xe0
      [ 1967.790031]  [<ffffffff81216045>] SyS_getdents+0x95/0x120
      [ 1967.790031]  [<ffffffff816b9449>] system_call_fastpath+0x16/0x1b
      [ 1967.790031] Code: 90 31 d2 48 89 d0 5d c3 85 f6 74 f5 8d 4e 01 89 f0 f0 0f b1 0f 39 f0 74 e2 89 c6 eb eb 0f 1f 40 00 66 66 66 66 90 55 48 89 e5 53 <48> 8b 47 30 48 89 fb a8 04 74 3b 8b 57 60 83 fa 02 74 19 8d 4a
      [ 1967.790031] RIP  [<ffffffffc06d6aea>] nfs4_put_deviceid_node+0xa/0x90 [nfsv4]
      [ 1967.790031]  RSP <ffff8800c4067978>
      [ 1967.790031] CR2: 0000000000000030
      Signed-off-by: NScott Mayhew <smayhew@redhat.com>
      Fixes: 1ebf9801 ("NFS/filelayout: Fix racy setting of fl->dsaddr...")
      Cc: stable@vger.kernel.org # v4.13+
      Signed-off-by: NTrond Myklebust <trond.myklebust@primarydata.com>
      0a47df11