[DragonFlyBSD - Bug #2909] (Closed) /dev/md* open behavior

bugtracker-admin at leaf.dragonflybsd.org bugtracker-admin at leaf.dragonflybsd.org
Mon May 30 04:07:49 PDT 2016


Issue #2909 has been updated by tkusumi.

Status changed from New to Closed

----------------------------------------
Bug #2909: /dev/md* open behavior
http://bugs.dragonflybsd.org/issues/2909#change-12893

* Author: tkusumi
* Status: Closed
* Priority: Normal
* Assignee: 
* Category: 
* Target version: 
----------------------------------------
Running
https://leaf.dragonflybsd.org/~tkusumi/diff/md1.py
adds an extra md device for no reason.

The issue is in open(2) when the path /dev/mdN contains the maximum available N at that point.
>From the way sys/dev/disk/md/md.c is implemented it seems this is intended behavior, but weird.

This becomes a problem when running autofs userspace sh script which runs fstyp internally.
Everytime it runs it adds /dev/md(N+1) whether /dev/md* is really used or not.


[root@]~# uname -r
4.5-DEVELOPMENT
[root@]~# python ./md1.py
['/dev/md0']
<open file '/dev/md0', mode 'r' at 0x800c8f5d0>
['/dev/md0', '/dev/md1']
[root@]~# python ./md1.py
['/dev/md0', '/dev/md1']
<open file '/dev/md1', mode 'r' at 0x800c8f5d0>
['/dev/md0', '/dev/md1', '/dev/md2']
[root@]~# python ./md1.py
['/dev/md0', '/dev/md1', '/dev/md2']
<open file '/dev/md2', mode 'r' at 0x800c8f5d0>
['/dev/md0', '/dev/md1', '/dev/md2', '/dev/md3']
[root@]~# python ./md1.py
['/dev/md0', '/dev/md1', '/dev/md2', '/dev/md3']
<open file '/dev/md3', mode 'r' at 0x800c8f5d0>
['/dev/md0', '/dev/md1', '/dev/md2', '/dev/md3', '/dev/md4']
[root@]~# python ./md1.py
['/dev/md0', '/dev/md1', '/dev/md2', '/dev/md3', '/dev/md4']
<open file '/dev/md4', mode 'r' at 0x800c8f5d0>
['/dev/md0', '/dev/md1', '/dev/md2', '/dev/md3', '/dev/md4', '/dev/md5']
[root@]~# python ./md1.py
['/dev/md0', '/dev/md1', '/dev/md2', '/dev/md3', '/dev/md4', '/dev/md5']
<open file '/dev/md5', mode 'r' at 0x800c8f5d0>
['/dev/md0', '/dev/md1', '/dev/md2', '/dev/md3', '/dev/md4', '/dev/md5', '/dev/md6']
[root@]~# python ./md1.py
['/dev/md0', '/dev/md1', '/dev/md2', '/dev/md3', '/dev/md4', '/dev/md5', '/dev/md6']
<open file '/dev/md6', mode 'r' at 0x800c8f5d0>
['/dev/md0', '/dev/md1', '/dev/md2', '/dev/md3', '/dev/md4', '/dev/md5', '/dev/md6', '/dev/md7']
[root@]~# python ./md1.py
['/dev/md0', '/dev/md1', '/dev/md2', '/dev/md3', '/dev/md4', '/dev/md5', '/dev/md6', '/dev/md7']
<open file '/dev/md7', mode 'r' at 0x800c8f5d0>
['/dev/md0', '/dev/md1', '/dev/md2', '/dev/md3', '/dev/md4', '/dev/md5', '/dev/md6', '/dev/md7', '/dev/md8']
[root@]~# python ./md1.py
['/dev/md0', '/dev/md1', '/dev/md2', '/dev/md3', '/dev/md4', '/dev/md5', '/dev/md6', '/dev/md7', '/dev/md8']
<open file '/dev/md8', mode 'r' at 0x800c8f5d0>
['/dev/md0', '/dev/md1', '/dev/md2', '/dev/md3', '/dev/md4', '/dev/md5', '/dev/md6', '/dev/md7', '/dev/md8', '/dev/md9']
[root@]~# python ./md1.py
['/dev/md0', '/dev/md1', '/dev/md2', '/dev/md3', '/dev/md4', '/dev/md5', '/dev/md6', '/dev/md7', '/dev/md8', '/dev/md9']
<open file '/dev/md9', mode 'r' at 0x800c8f5d0>
['/dev/md0', '/dev/md1', '/dev/md10', '/dev/md2', '/dev/md3', '/dev/md4', '/dev/md5', '/dev/md6', '/dev/md7', '/dev/md8', '/dev/md9']


On FreeBSD, though the code base is not the same.

[root@]~# uname -r
11.0-CURRENT
[root@]~# python ./md1.py
['/dev/md0']
<open file '/dev/md0', mode 'r' at 0x80073d5d0>
['/dev/md0']
[root@]~# python ./md1.py
['/dev/md0']
<open file '/dev/md0', mode 'r' at 0x80073d5d0>
['/dev/md0']
[root@]~# python ./md1.py
['/dev/md0']
<open file '/dev/md0', mode 'r' at 0x80073d5d0>
['/dev/md0']
[root@]~# python ./md1.py
['/dev/md0']
<open file '/dev/md0', mode 'r' at 0x80073d5d0>
['/dev/md0']
[root@]~# python ./md1.py
['/dev/md0']
<open file '/dev/md0', mode 'r' at 0x80073d5d0>
['/dev/md0']
[root@]~# python ./md1.py
['/dev/md0']
<open file '/dev/md0', mode 'r' at 0x80073d5d0>
['/dev/md0']




-- 
You have received this notification because you have either subscribed to it, or are involved in it.
To change your notification preferences, please click here: http://bugs.dragonflybsd.org/my/account



More information about the Bugs mailing list