On Mon, May 29, 2017 at 01:50:30PM +0200, Richard Weinberger wrote: > CC'ing VFS folks > > Am 29.05.2017 um 09:22 schrieb Rabin Vincent: > > From: Rabin Vincent <rabinv@xxxxxxxx> > > > > There currently appears to be no way for userspace to find out the > > underlying volume number for a mounted ubifs file system, since ubifs > > uses anonymous block devices. The volume name is present in > > /proc/mounts but UBI volumes can be renamed after the volume has been > > mounted. > > > > To remedy this, provide a directory in /sys/fs/ubifs named after the > > underlying anonymous block device's number (obtainable by userspace via > > stat(2)) and provide a link named "ubi" to the underlying UBI volume. > > I wonder whether it would make more sense to just assign the character device > number of the UBI volume to ->s_dev. > Then userspace can query the underlying device without additional sysfs > magic. > > Sure if userspace expects a block number from UBIFS it will get confused. > > Comments? Userspace sure as hell does. st_dev in stat(2) is a block device number; moreover, there might _be_ a block device with the same number at the same time - even mounted. Why not make ->show_options() print the currently valid volume name, anyway? That would seem to be the obvious approach...