From: Dan Carpenter <dan.carpenter@oracle.com>
To: kbuild@lists.01.org, Qu Wenruo <wqu@suse.com>,
linux-btrfs@vger.kernel.org
Cc: lkp@intel.com, kbuild-all@lists.01.org
Subject: [kbuild] Re: [PATCH 3/3] btrfs: allow BTRFS_IOC_SNAP_DESTROY_V2 to remove ghost subvolume
Date: Tue, 29 Jun 2021 10:04:55 +0300 [thread overview]
Message-ID: <202106290158.0Vwb1dj2-lkp@intel.com> (raw)
In-Reply-To: <20210628101637.349718-4-wqu@suse.com>
Hi Qu,
url: https://github.com/0day-ci/linux/commits/Qu-Wenruo/btrfs-allow-BTRFS_IOC_SNAP_DESTROY_V2-to-remove-ghost-subvolume/20210628-181747
base: https://git.kernel.org/pub/scm/linux/kernel/git/kdave/linux.git for-next
config: i386-randconfig-m021-20210628 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-22) 9.3.0
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
New smatch warnings:
fs/btrfs/ioctl.c:2967 remove_ghost_subvol() error: uninitialized symbol 'ret'.
Old smatch warnings:
fs/btrfs/ioctl.c:808 create_snapshot() warn: '&pending_snapshot->list' not removed from list
fs/btrfs/ioctl.c:1568 btrfs_defrag_file() warn: should 'ret << 12' be a 64 bit type?
vim +/ret +2967 fs/btrfs/ioctl.c
391ab0041fef57 Qu Wenruo 2021-06-28 2904 static int __cold remove_ghost_subvol(struct btrfs_fs_info *fs_info,
391ab0041fef57 Qu Wenruo 2021-06-28 2905 u64 rootid)
391ab0041fef57 Qu Wenruo 2021-06-28 2906 {
391ab0041fef57 Qu Wenruo 2021-06-28 2907 struct btrfs_trans_handle *trans;
391ab0041fef57 Qu Wenruo 2021-06-28 2908 struct btrfs_root *root;
391ab0041fef57 Qu Wenruo 2021-06-28 2909 struct btrfs_path *path;
391ab0041fef57 Qu Wenruo 2021-06-28 2910 struct btrfs_key key;
391ab0041fef57 Qu Wenruo 2021-06-28 2911 int ret;
391ab0041fef57 Qu Wenruo 2021-06-28 2912
391ab0041fef57 Qu Wenruo 2021-06-28 2913 root = btrfs_get_fs_root(fs_info, rootid, false);
391ab0041fef57 Qu Wenruo 2021-06-28 2914 if (IS_ERR(root)) {
391ab0041fef57 Qu Wenruo 2021-06-28 2915 ret = PTR_ERR(root);
391ab0041fef57 Qu Wenruo 2021-06-28 2916 return ret;
return PTR_ERR(root);
391ab0041fef57 Qu Wenruo 2021-06-28 2917 }
391ab0041fef57 Qu Wenruo 2021-06-28 2918
391ab0041fef57 Qu Wenruo 2021-06-28 2919 /* A ghost subvolume is already a problem, better to output a warning */
391ab0041fef57 Qu Wenruo 2021-06-28 2920 btrfs_warn(fs_info, "root %llu has no refs nor orphan item", rootid);
391ab0041fef57 Qu Wenruo 2021-06-28 2921 if (btrfs_root_refs(&root->root_item) != 0) {
391ab0041fef57 Qu Wenruo 2021-06-28 2922 /* We get some strange root */
391ab0041fef57 Qu Wenruo 2021-06-28 2923 btrfs_warn(fs_info,
391ab0041fef57 Qu Wenruo 2021-06-28 2924 "root %llu has %u refs, but no proper root backref",
391ab0041fef57 Qu Wenruo 2021-06-28 2925 rootid, btrfs_root_refs(&root->root_item));
391ab0041fef57 Qu Wenruo 2021-06-28 2926 ret = -EUCLEAN;
391ab0041fef57 Qu Wenruo 2021-06-28 2927 goto out;
391ab0041fef57 Qu Wenruo 2021-06-28 2928 }
391ab0041fef57 Qu Wenruo 2021-06-28 2929
391ab0041fef57 Qu Wenruo 2021-06-28 2930 /* Already has orphan inserted */
391ab0041fef57 Qu Wenruo 2021-06-28 2931 if (test_bit(BTRFS_ROOT_ORPHAN_ITEM_INSERTED, &root->state))
391ab0041fef57 Qu Wenruo 2021-06-28 2932 goto out;
ret not intialized on this path.
391ab0041fef57 Qu Wenruo 2021-06-28 2933
391ab0041fef57 Qu Wenruo 2021-06-28 2934 path = btrfs_alloc_path();
391ab0041fef57 Qu Wenruo 2021-06-28 2935 if (!path) {
391ab0041fef57 Qu Wenruo 2021-06-28 2936 ret = -ENOMEM;
391ab0041fef57 Qu Wenruo 2021-06-28 2937 goto out;
391ab0041fef57 Qu Wenruo 2021-06-28 2938 }
391ab0041fef57 Qu Wenruo 2021-06-28 2939 key.objectid = BTRFS_ORPHAN_OBJECTID;
391ab0041fef57 Qu Wenruo 2021-06-28 2940 key.type = BTRFS_ORPHAN_ITEM_KEY;
391ab0041fef57 Qu Wenruo 2021-06-28 2941 key.offset = rootid;
391ab0041fef57 Qu Wenruo 2021-06-28 2942
391ab0041fef57 Qu Wenruo 2021-06-28 2943 ret = btrfs_search_slot(NULL, fs_info->tree_root, &key, path, 0, 0);
391ab0041fef57 Qu Wenruo 2021-06-28 2944 btrfs_free_path(path);
391ab0041fef57 Qu Wenruo 2021-06-28 2945 /* Either error or there is already an orphan item */
391ab0041fef57 Qu Wenruo 2021-06-28 2946 if (ret <= 0)
391ab0041fef57 Qu Wenruo 2021-06-28 2947 goto out;
391ab0041fef57 Qu Wenruo 2021-06-28 2948
391ab0041fef57 Qu Wenruo 2021-06-28 2949 trans = btrfs_start_transaction(fs_info->tree_root, 1);
391ab0041fef57 Qu Wenruo 2021-06-28 2950 if (IS_ERR(trans)) {
391ab0041fef57 Qu Wenruo 2021-06-28 2951 ret = PTR_ERR(trans);
391ab0041fef57 Qu Wenruo 2021-06-28 2952 goto out;
391ab0041fef57 Qu Wenruo 2021-06-28 2953 }
391ab0041fef57 Qu Wenruo 2021-06-28 2954
391ab0041fef57 Qu Wenruo 2021-06-28 2955 ret = btrfs_insert_orphan_item(trans, fs_info->tree_root, rootid);
391ab0041fef57 Qu Wenruo 2021-06-28 2956 if (ret < 0 && ret != -EEXIST) {
391ab0041fef57 Qu Wenruo 2021-06-28 2957 btrfs_abort_transaction(trans, ret);
391ab0041fef57 Qu Wenruo 2021-06-28 2958 goto end_trans;
391ab0041fef57 Qu Wenruo 2021-06-28 2959 }
391ab0041fef57 Qu Wenruo 2021-06-28 2960 ret = 0;
391ab0041fef57 Qu Wenruo 2021-06-28 2961 btrfs_add_dead_root(root);
391ab0041fef57 Qu Wenruo 2021-06-28 2962
391ab0041fef57 Qu Wenruo 2021-06-28 2963 end_trans:
391ab0041fef57 Qu Wenruo 2021-06-28 2964 btrfs_end_transaction(trans);
391ab0041fef57 Qu Wenruo 2021-06-28 2965 out:
391ab0041fef57 Qu Wenruo 2021-06-28 2966 btrfs_put_root(root);
391ab0041fef57 Qu Wenruo 2021-06-28 @2967 return ret;
391ab0041fef57 Qu Wenruo 2021-06-28 2968 }
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
_______________________________________________
kbuild mailing list -- kbuild@lists.01.org
To unsubscribe send an email to kbuild-leave@lists.01.org
next prev parent reply other threads:[~2021-06-29 7:05 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-06-28 10:16 [PATCH 0/3] btrfs: allow BTRFS_IOC_SNAP_DESTROY_V2 to remove ghost subvolume Qu Wenruo
2021-06-28 10:16 ` [PATCH 1/3] btrfs: return -EINVAL if some user wants to remove uuid/data_reloc tree Qu Wenruo
2021-06-28 10:59 ` Anand Jain
2021-06-28 10:16 ` [PATCH 2/3] btrfs: remove dead comment on btrfs_add_dead_root() Qu Wenruo
2021-06-28 11:01 ` Anand Jain
2021-06-28 10:16 ` [PATCH 3/3] btrfs: allow BTRFS_IOC_SNAP_DESTROY_V2 to remove ghost subvolume Qu Wenruo
2021-06-28 16:22 ` kernel test robot
2021-06-28 16:23 ` kernel test robot
2021-06-29 7:04 ` Dan Carpenter [this message]
2021-06-30 13:16 ` David Sterba
2021-06-30 13:26 ` Qu Wenruo
2021-06-30 13:30 ` David Sterba
2021-06-30 13:35 ` Qu Wenruo
2021-07-20 4:05 ` [PATCH 0/3] " Zygo Blaxell
2021-07-20 4:33 ` Qu Wenruo
2021-07-20 15:41 ` Zygo Blaxell
2021-07-20 22:40 ` Qu Wenruo
2021-08-20 5:45 ` Qu Wenruo
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=202106290158.0Vwb1dj2-lkp@intel.com \
--to=dan.carpenter@oracle.com \
--cc=kbuild-all@lists.01.org \
--cc=kbuild@lists.01.org \
--cc=linux-btrfs@vger.kernel.org \
--cc=lkp@intel.com \
--cc=wqu@suse.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).