linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Anand Jain <anand.jain@oracle.com>
To: linux-btrfs@vger.kernel.org
Cc: g.btrfs@cobb.uk.net, calestyo@scientia.net
Subject: [PATCH] btrfs: ratelimit device path change info on mounted device
Date: Tue, 16 Jul 2019 21:59:10 +0800	[thread overview]
Message-ID: <20190716135910.848-1-anand.jain@oracle.com> (raw)
In-Reply-To: <5d8baf80-4fb3-221f-5ab4-e98a838f63e1@cobb.uk.net>

If there are more than one path to a device, the last scanned path
will map to the mounted FS. In some Linux based os there appears to be a
system script (autofs?) which fails to notice that a device's alternative
path is already mounted, and so the change in device-path gets logged
every ~2mins whenever such a script is active.

kernel: [33017.407252] BTRFS info (device sdc3):
device fsid 4d1ba5af-8b89-4cb5-96c6-55d1f028a202 devid 4 moved
old:/dev/mapper/cryptdata4tb--vg-backup new:/dev/dm-13
kernel: [33017.522242] BTRFS info (device sdc3):
device fsid 4d1ba5af-8b89-4cb5-96c6-55d1f028a202 devid 4 moved
old:/dev/dm-13 new:/dev/mapper/cryptdata4tb--vg-backup
kernel: [33018.797161] BTRFS info (device sdc3):
device fsid 4d1ba5af-8b89-4cb5-96c6-55d1f028a202 devid 4 moved
old:/dev/mapper/cryptdata4tb--vg-backup new:/dev/dm-13
kernel: [33019.061631] BTRFS info (device sdc3):
device fsid 4d1ba5af-8b89-4cb5-96c6-55d1f028a202 devid 4 moved
old:/dev/dm-13 new:/dev/mapper/cryptdata4tb--vg-backup

Fix this by using the ratelimit printk.

Signed-off-by: Anand Jain <anand.jain@oracle.com>
Reported-by: g.btrfs@cobb.uk.net
Reported-by: calestyo@scientia.net
---
 fs/btrfs/volumes.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c
index a13ddba1ebc3..b4c4add7b5e7 100644
--- a/fs/btrfs/volumes.c
+++ b/fs/btrfs/volumes.c
@@ -1086,7 +1086,7 @@ static noinline struct btrfs_device *device_list_add(const char *path,
 				return ERR_PTR(-EEXIST);
 			}
 			bdput(path_bdev);
-			btrfs_info_in_rcu(device->fs_info,
+			btrfs_info_rl_in_rcu(device->fs_info,
 				"device fsid %pU devid %llu moved old:%s new:%s",
 				disk_super->fsid, devid,
 				rcu_str_deref(device->name), path);
-- 
2.21.0 (Apple Git-120)


  parent reply	other threads:[~2019-07-16 13:59 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-07-10 18:49 "btrfs: harden agaist duplicate fsid" spams syslog Graham Cobb
2019-07-11  2:46 ` Anand Jain
2019-07-11 18:00   ` Graham Cobb
2019-07-12 12:46     ` Anand Jain
2019-07-12 13:32       ` Graham Cobb
2019-07-19 15:38         ` David Sterba
2019-07-12 13:35       ` Patrik Lundquist
2019-07-12 13:41         ` Graham Cobb
2019-07-11 23:06   ` Christoph Anton Mitterer
2019-07-12 12:49     ` Anand Jain
2019-07-16 13:59 ` Anand Jain [this message]
2019-07-16 14:08   ` [PATCH] btrfs: ratelimit device path change info on mounted device Anand Jain
2019-07-19 14:58   ` David Sterba

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=20190716135910.848-1-anand.jain@oracle.com \
    --to=anand.jain@oracle.com \
    --cc=calestyo@scientia.net \
    --cc=g.btrfs@cobb.uk.net \
    --cc=linux-btrfs@vger.kernel.org \
    /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).