Re: should bdi_init() initialize congested_fn?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Oct 13, 2011 at 05:12:29PM +0200, Bernd Schubert wrote:
> Hello,
> 
> while testing FhGFS I got a stack trace that seems to point out that
> bdi_congested() tries to call an uninitialized bdi->congested_fn().

Right. bdi_init() assumes you've zero'd the structure before
calling - it doesn't initialise any fields have a zero value.

> So I checked where ->congested_fn() is initialized - with exception
> of btrfs I do not find a file system that does that at all.

the bdi congestion function is filled out by the underlying block
device when the block device is initialised. Most filesystems get
their bdi from the underlying device when they are mounted. See
mount_bdev/set_bdev_super.

btrfs is a special case. You'd do best to ignore the games btrfs
plays while trying to understand how the generic infrastructure
works. ;)

> But then
> bdi_init(), which is called by most file systems for initialization
> also does *not* initialize it. So either I'm missing something, or
> almost all bdi users have a bug?

bdi_init() is only used by filesystems that done not operate
directly on a block device with that a bdi can be taken from. e.g.
filesystems without a backing store (ramfs, /proc, /sys, etc)Da, or
have special needs (e.g. ubifs). They are all ensuring that the
unused fields of the bdi are zero before calling bdi_init().

Cheers,

Dave.
-- 
Dave Chinner
david@xxxxxxxxxxxxx
--
To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [Samba]     [Device Mapper]     [CEPH Development]
  Powered by Linux