linux-raid.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Stephane Bunel <stephane.bunel@forumdesimages.fr>
To: Mario 'BitKoenig' Holbe <Mario.Holbe@TU-Ilmenau.DE>
Cc: linux-raid@vger.kernel.org
Subject: Re: mdadm --detail showing annoying device
Date: Thu, 22 Oct 2009 18:00:15 +0200	[thread overview]
Message-ID: <4AE0818F.80101@forumdesimages.fr> (raw)
In-Reply-To: <4AE06991.5040000@forumdesimages.fr>

Stephane Bunel a écrit :
> Mario 'BitKoenig' Holbe a écrit :
>> Neil Brown <neilb@suse.de> wrote:
>>> On Wednesday October 21, stephane.bunel@forumdesimages.fr wrote:
>>>>         0       8        0        0      active sync   /dev/char/21:0
>>>>         1       8       16        1      active sync   /dev/char/21:1
>>> What is a block device doing in /dev/char ???  There should only be
>>> character devices in there.
>>
>> major 21 are usually SCSI generic devices (/dev/sg) and they are char...
>> crw-rw----  1 root root  21, 0 Oct 10 21:48 /dev/sg0
>> crw-rw----  1 root root  21, 1 Oct 10 21:48 /dev/sg1
>>
>> The question is, why do they appear at mdadm --detail
> 
>   mdadm performs a physical walk to not follow symbolic links (cf nftw( 
> FTW_PHYS ) in map_dev() ). But using stat() mdadm finaly follow the 
> symbolic link and so returns the same type/major/minor as the targeted 
> link.
> 
>   lstat() is identical to stat(), except that if path is a symbolic 
> link, then the link itself is stat-ed, not the file that it refers to.
> 
> 
> #ls -la /dev/char/21:0
> lrwxrwxrwx 1 root root 13 2009-10-16 18:12 /dev/char/21:0 -> ../raid_disk0
> 
> Tested from Python:
>  >>> import os, stat
> 
> Using stat:
>  >>> mode = os.stat( '/dev/char/21:0' )[ stat.ST_MODE ]
>  >>> stat.S_ISBLK( mode )
> True
> 
> using lstat():
>  >>> mode = os.lstat( '/dev/char/21:0' )[ stat.ST_MODE ]
>  >>> stat.S_ISBLK( mode )
> False


Just for fun ;-)

--- util.c.orig	2009-10-22 17:54:11.000000000 +0200
+++ util.c	2009-10-22 17:55:09.000000000 +0200
@@ -468,7 +468,7 @@
  	struct stat st;

  	if (S_ISLNK(stb->st_mode)) {
-		if (stat(name, &st) != 0)
+		if (lstat(name, &st) != 0)
  			return 0;
  		stb = &st;
  	}



Stéphane Bunel.

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

  reply	other threads:[~2009-10-22 16:00 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-10-17 22:34 2.6.31+2.6.31.4: XFS - All I/O locks up to D-state after 24-48 hours (sysrq-t+w available) Justin Piszcz
2009-10-18 20:17 ` Justin Piszcz
2009-10-19  3:04   ` Dave Chinner
2009-10-19 10:18     ` Justin Piszcz
2009-10-20  0:33       ` Dave Chinner
2009-10-20  8:33         ` Justin Piszcz
2009-10-21 10:19           ` Justin Piszcz
2009-10-21 14:17             ` mdadm --detail showing annoying device Stephane Bunel
2009-10-21 21:46               ` Neil Brown
2009-10-22 11:22                 ` Stephane Bunel
2009-10-29  3:44                   ` Neil Brown
2009-11-03  9:37                     ` Stephane Bunel
2009-11-03 10:09                       ` Beolach
2009-11-03 12:16                         ` Stephane Bunel
2009-10-22 11:29                 ` Mario 'BitKoenig' Holbe
2009-10-22 14:17                   ` Stephane Bunel
2009-10-22 16:00                     ` Stephane Bunel [this message]
2009-10-22 22:49             ` 2.6.31+2.6.31.4: XFS - All I/O locks up to D-state after 24-48 hours (sysrq-t+w available) Justin Piszcz
2009-10-22 23:00               ` Dave Chinner
2009-10-26 11:24               ` Justin Piszcz
2009-11-02 21:46                 ` Justin Piszcz
2009-11-20 20:39             ` 2.6.31+2.6.31.4: XFS - All I/O locks up to D-state after 24-48 hours (sysrq-t+w available) - root cause found = asterisk Justin Piszcz
2009-11-20 23:44               ` Bug#557262: " Faidon Liambotis
2009-11-20 23:51                 ` Justin Piszcz
2009-11-21 14:29                 ` Roger Heflin
2009-11-24 13:08 ` Which kernel options should be enabled to find the root cause of this bug? Justin Piszcz
2009-11-24 15:14   ` Eric Sandeen
2009-11-24 16:20     ` Justin Piszcz
2009-11-24 16:23       ` Eric Sandeen

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=4AE0818F.80101@forumdesimages.fr \
    --to=stephane.bunel@forumdesimages.fr \
    --cc=Mario.Holbe@TU-Ilmenau.DE \
    --cc=linux-raid@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).