From: Miao Xie <miaox@cn.fujitsu.com>
To: fdmanana@gmail.com
Cc: "linux-btrfs@vger.kernel.org" <linux-btrfs@vger.kernel.org>
Subject: Re: [PATCH 02/12] Btrfs-progs: don't close the file descriptor 0 when closing a device
Date: Thu, 04 Jul 2013 09:30:54 +0800 [thread overview]
Message-ID: <51D4D04E.8070408@cn.fujitsu.com> (raw)
In-Reply-To: <CAL3q7H5gxGg8p2JbtVtFcrgL9cMpD4S=LSf9aQ+2Y4wbz-ks6A@mail.gmail.com>
On wed, 3 Jul 2013 15:17:02 +0100, Filipe David Manana wrote:
> On Wed, Jul 3, 2013 at 2:25 PM, Miao Xie <miaox@cn.fujitsu.com> wrote:
>>
>> +++ b/disk-io.c
>> @@ -1270,12 +1270,13 @@ static int close_all_devices(struct btrfs_fs_info *fs_info)
>> while (!list_empty(list)) {
>> device = list_entry(list->next, struct btrfs_device, dev_list);
>> list_del_init(&device->dev_list);
>> - if (device->fd) {
>> + if (device->fd != -1) {
>> fsync(device->fd);
>> if (posix_fadvise(device->fd, 0, 0, POSIX_FADV_DONTNEED))
>> fprintf(stderr, "Warning, could not drop caches\n");
>> + close(device->fd);
>> + device->fd = -1;
>> }
>> - close(device->fd);
>> kfree(device->name);
>> kfree(device->label);
>> kfree(device);
>
> I deal with this part too at https://patchwork.kernel.org/patch/2787291/
Sorry, I don't know you have dealt with it. But your patch didn't fix the problem completely,
there are still some functions that you didn't deal with.
> Is there any reason to set device->fd to -1 if we just kfree(device)
> shortly after?
Right, I will update my patch.
Thanks
Miao
> thanks
>
>
> --
> Filipe David Manana,
>
> "Reasonable men adapt themselves to the world.
> Unreasonable men adapt the world to themselves.
> That's why all progress depends on unreasonable men."
> --
> 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:[~2013-07-04 1:29 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-07-03 13:25 [RFC PATCH 00/12] Btrfs-progs: introduce chunk recover function Miao Xie
2013-07-03 13:25 ` [PATCH 01/12] Btrfs-progs: fix missing recow roots when making btrfs filesystem Miao Xie
2013-07-03 13:25 ` [PATCH 02/12] Btrfs-progs: don't close the file descriptor 0 when closing a device Miao Xie
2013-07-03 14:17 ` Filipe David Manana
2013-07-04 1:30 ` Miao Xie [this message]
2013-07-04 8:30 ` Filipe David Manana
2013-07-03 13:25 ` [PATCH 03/12] Btrfs-progs: Don't free the devices when close the ctree Miao Xie
2013-07-08 4:59 ` Anand Jain
2013-07-15 4:58 ` Anand Jain
2013-07-03 13:25 ` [PATCH 04/12] Btrfs-progs: cleanup similar code in open_ctree_* and close_ctree Miao Xie
2013-08-04 16:04 ` Eric Sandeen
2013-08-04 23:24 ` Wang Shilong
2013-08-04 23:43 ` Eric Sandeen
2013-07-03 13:25 ` [PATCH 05/12] Btrfs-progs: introduce common insert/search/delete functions for rb-tree Miao Xie
2013-07-03 13:25 ` [PATCH 06/12] Btrfs-progs: use rb-tree instead of extent cache tree for fs/file roots Miao Xie
2013-07-03 13:25 ` [PATCH 07/12] Btrfs-progs: extend the extent cache for the device extent Miao Xie
2013-07-03 13:25 ` [PATCH 08/12] Btrfs-progs: Add block group check funtion Miao Xie
2013-07-03 13:25 ` [PATCH 09/12] Btrfs-progs: Add chunk recover function - using old chunk items Miao Xie
2013-08-01 20:30 ` David Sterba
2013-07-03 13:25 ` [PATCH 10/12] Btrfs-progs: introduce list_{first, next}_entry/list_splice_tail{_init} Miao Xie
2013-07-03 13:25 ` [PATCH 11/12] Btrfs-progs: Add chunk rebuild function for RAID1/SINGLE/DUP Miao Xie
2013-07-03 13:25 ` [PATCH 12/12] Btrfs-progs: recover raid0/raid10/raid5/raid6 metadata chunk Miao Xie
2013-07-03 20:36 ` [RFC PATCH 00/12] Btrfs-progs: introduce chunk recover function Chris Mason
2013-07-04 4:06 ` Liu Bo
2013-07-05 14:00 ` Chris Mason
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=51D4D04E.8070408@cn.fujitsu.com \
--to=miaox@cn.fujitsu.com \
--cc=fdmanana@gmail.com \
--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).