From: Anand Jain <Anand.Jain@oracle.com>
To: Qu Wenruo <quwenruo@cn.fujitsu.com>, linux-btrfs@vger.kernel.org
Cc: Karel Zak <kzak@redhat.com>
Subject: Re: [PATCH RFC] btrfs: Add ctime/mtime update for btrfs device add/remove.
Date: Fri, 30 May 2014 15:53:12 +0800 [thread overview]
Message-ID: <538838E8.1050900@oracle.com> (raw)
In-Reply-To: <53883883.8020608@oracle.com>
I have sent this
[PATCH] btrfs: kobject_uevent should use bd_part instead of bd_disk
which should fix. Could you try and update.
Thanks, Anand
On 30/05/14 15:51, Anand Jain wrote:
>
>
>
>
> Hi Qu,
>
> In line below...
>
> On 16/04/14 17:02, Qu Wenruo wrote:
>> Btrfs will send uevent to udev inform the device change,
>> but ctime/mtime for the block device inode is not udpated, which cause
>> libblkid used by btrfs-progs unable to detect device change and use old
>> cache, causing 'btrfs dev scan; btrfs dev rmove; btrfs dev scan' give an
>> error message.
>>
>> Reported-by: Tsutomu Itoh <t-itoh@jp.fujitsu.com>
>> Cc: Karel Zak <kzak@redhat.com>
>> Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com>
>> ---
>> fs/btrfs/volumes.c | 26 ++++++++++++++++++++++++--
>> 1 file changed, 24 insertions(+), 2 deletions(-)
>>
>> diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c
>> index 49d7fab..ce232d7 100644
>> --- a/fs/btrfs/volumes.c
>> +++ b/fs/btrfs/volumes.c
>> @@ -1452,6 +1452,22 @@ out:
>> return ret;
>> }
>>
>> +/*
>> + * Function to update ctime/mtime for a given device path.
>> + * Mainly used for ctime/mtime based probe like libblkid.
>> + */
>> +static void update_dev_time(char *path_name)
>> +{
>> + struct file *filp;
>> +
>> + filp = filp_open(path_name, O_RDWR, 0);
>> + if (!filp)
>> + return;
>> + file_update_time(filp);
>> + filp_close(filp, NULL);
>> + return;
>> +}
>> +
>
> IMO /(I might be wrong) I think its not a good idea to explicitly
> achieve this. Since this thread would have already scratched the
> device's SB, shouldn't that take care of updating the mtime ?
>
> Thanks, Anand
>
>
>> static int btrfs_rm_dev_item(struct btrfs_root *root,
>> struct btrfs_device *device)
>> {
>> @@ -1704,10 +1720,14 @@ int btrfs_rm_device(struct btrfs_root *root,
>> char *device_path)
>>
>> ret = 0;
>>
>> - /* Notify udev that device has changed */
>> - if (bdev)
>> + if (bdev) {
>> + /* Notify udev that device has changed */
>> btrfs_kobject_uevent(bdev, KOBJ_CHANGE);
>>
>> + /* Update ctime/mtime for device path for libblkid */
>> + update_dev_time(device_path);
>> + }
>> +
>
>
>
>> error_brelse:
>> brelse(bh);
>> if (bdev)
>> @@ -2146,6 +2166,8 @@ int btrfs_init_new_device(struct btrfs_root
>> *root, char *device_path)
>> ret = btrfs_commit_transaction(trans, root);
>> }
>>
>> + /* Update ctime/mtime for libblkid */
>> + update_dev_time(device_path);
>> return ret;
>>
>> error_trans:
>>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
next prev parent reply other threads:[~2014-05-30 7:50 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-04-16 9:02 [PATCH RFC] btrfs: Add ctime/mtime update for btrfs device add/remove Qu Wenruo
2014-05-29 12:43 ` David Sterba
2014-05-30 1:27 ` Qu Wenruo
2014-06-04 5:51 ` Qu Wenruo
2014-05-30 7:51 ` Anand Jain
2014-05-30 7:53 ` Anand Jain [this message]
2014-05-30 8:43 ` 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=538838E8.1050900@oracle.com \
--to=anand.jain@oracle.com \
--cc=kzak@redhat.com \
--cc=linux-btrfs@vger.kernel.org \
--cc=quwenruo@cn.fujitsu.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).