Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933381AbYCSXLo (ORCPT ); Wed, 19 Mar 2008 19:11:44 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S937874AbYCSVgo (ORCPT ); Wed, 19 Mar 2008 17:36:44 -0400 Received: from mx1.redhat.com ([66.187.233.31]:52510 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933045AbYCSVgm (ORCPT ); Wed, 19 Mar 2008 17:36:42 -0400 Date: Tue, 18 Mar 2008 13:21:13 -0400 From: Bill Nottingham To: linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org Cc: kay.sievers@vrfy.org Subject: race between SCSI uevents and media detection Message-ID: <20080318172113.GB3089@nostromo.devel.redhat.com> Mail-Followup-To: linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org, kay.sievers@vrfy.org MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.5.17 (2007-11-01) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 953 Lines: 24 For a typical livecd boot using udev, you'd check for the root device with a udev rule like: KERNEL=="sr[0-9]", PROGRAM=="/lib/udev/vol_id -l %N", RESULT="", SYMLINK+="root" This creates a /dev/root symlink to whichever CD device holds the proper CD/DVD. However, this currently fails repeatedly on some machines, as the run of vol_id gets ENOMEDIUM attempting to open the CD device. I suspect this is because the initial medium scan is actually done after the uevent for /dev/sr0 is emitted. Can the open path be fixed to block until the medium state is initially known? I don't see how this can be worked around from userspace - you don't get another uevent for the media detection. Bill -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/