public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: viro@parcelfarce.linux.theplanet.co.uk
To: Samphan Raruenrom <samphan@nectec.or.th>
Cc: Jens Axboe <axboe@image.dk>,
	linux-kernel@vger.kernel.org, Linux TLE Team <rdi1@opentle.org>,
	Marcelo Tosatti <marcelo@conectiva.com.br>
Subject: Re: [PATCH] Add MOUNT_STATUS ioctl to cdrom device
Date: Mon, 25 Aug 2003 21:03:32 +0100	[thread overview]
Message-ID: <20030825200332.GJ454@parcelfarce.linux.theplanet.co.uk> (raw)
In-Reply-To: <3F4A53ED.60801@nectec.or.th>

On Tue, Aug 26, 2003 at 01:22:37AM +0700, Samphan Raruenrom wrote:
> Hi,
> 
> This patch add a new ioctl MOUNT_STATUS to the 2.4 kernel's cdrom
> device. It'll be used as an API to query the mount status of a
> cdrom :-
> 
> CDROM_MOUNT_STATUS
> Return :-
> 0 = not mount.
> 1 = mounted, but not in-use. It is ok to umount.
> 2 = busy. Umount will result in getting EBUSY.
> <0 = error.

Huh?   And what, pray tell, makes cdrom special?  Not to mention
the use of ioctl, the inherent raciness of the interface and the fact
that yes,
 
> This same functionality can be done in user-space,

... which should be the end of it.

> +	case CDROM_MOUNT_STATUS: {
> +		struct super_block *sb = get_super(dev);
> +		if (sb == NULL) return -EINVAL;
> +		down_read(&current->namespace->sem);
> +		struct vfsmount *mnt = NULL;
> +		struct list_head *p;
> +		list_for_each(p, &current->namespace->list) {
> +			struct vfsmount *m = list_entry(p, struct vfsmount, 
> mnt_list);
> +			if (sb == m->mnt_sb) {
> +				mnt = m; break;
> +			}
> +		}
> +		up_read(&current->namespace->sem);		

And what about other namespaces?

> +		drop_super(sb);		
> +		int mstat = 0; /* 0 not mounted, 1 umount ok, 2 umount EBUSY 
> */
> +		if (mnt) mstat = 1 + (atomic_read(&mnt->mnt_count) > 1);

Or the possibility that
	* mnt might've been freed by that point.
	* we might have the damn thing mounted in several places, some
busy, some not.
	* cdrom had been used not by mount.
	* cdrom had been mounted just as we had decided to tell that it's
not busy.

      parent reply	other threads:[~2003-08-25 20:03 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-08-25 18:22 [PATCH] Add MOUNT_STATUS ioctl to cdrom device Samphan Raruenrom
2003-08-25 18:50 ` Christoph Hellwig
2003-08-26  6:50   ` Samphan Raruenrom
2003-08-26  7:32     ` Christoph Hellwig
2003-08-26  9:09       ` Samphan Raruenrom
2003-08-26  9:56         ` Christoph Hellwig
2003-08-26  9:58           ` Jens Axboe
2003-08-26 11:30             ` [Rdi1] " Samphan Raruenrom
2003-08-26 11:36               ` Jens Axboe
2003-08-26 12:44                 ` Samphan Raruenrom
2003-08-26 14:16                   ` Jens Axboe
2003-08-26 13:58               ` Christoph Hellwig
2003-08-26 15:32                 ` Samphan Raruenrom
2003-08-26 15:45                   ` Jens Axboe
2003-08-25 20:03 ` viro [this message]

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=20030825200332.GJ454@parcelfarce.linux.theplanet.co.uk \
    --to=viro@parcelfarce.linux.theplanet.co.uk \
    --cc=axboe@image.dk \
    --cc=linux-kernel@vger.kernel.org \
    --cc=marcelo@conectiva.com.br \
    --cc=rdi1@opentle.org \
    --cc=samphan@nectec.or.th \
    /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