if (sc->first_open) { if (sc->changed) { sc->first_open = 0; 
if (lun->first_open) { lun->first_open = 0; if (lun->changed) { 
static int ub_bd_open(struct inode *inode, struct file *filp){	struct gendisk *disk = inode->i_bdev->bd_disk;	struct ub_dev *sc;	unsigned long flags;	int rc;	if ((sc = disk->private_data) == NULL)		return -ENXIO;	spin_lock_irqsave(&ub_lock, flags);	if (atomic_read(&sc->poison)) {		spin_unlock_irqrestore(&ub_lock, flags);		return -ENXIO;	}	sc->openc++;	spin_unlock_irqrestore(&ub_lock, flags);	/*	 * This is a workaround for a specific problem in our block layer.	 * In 2.6.9, register_disk duplicates the code from rescan_partitions.	 * However, if we do add_disk with a device which persistently reports	 * a changed media, add_disk calls register_disk, which does do_open,	 * which will call rescan_paritions for changed media. After that,	 * register_disk attempts to do it all again and causes double kobject	 * registration and a eventually an oops on module removal.	 *	 * The bottom line is, Al Viro says that we should not allow	 * bdev->bd_invalidated to be set when doing add_disk no matter what.	 */	if (sc->first_open) {		if (sc->changed) {			sc->first_open = 0;			rc = -ENOMEDIUM;			goto err_open;		}	}	if (sc->removable || sc->readonly)		check_disk_change(inode->i_bdev);	/*	 * The sd.c considers ->media_present and ->changed not equivalent,	 * under some pretty murky conditions (a failure of READ CAPACITY).	 * We may need it one day.	 */	if (sc->removable && sc->changed && !(filp->f_flags & O_NDELAY)) {		rc = -ENOMEDIUM;		goto err_open;	}	if (sc->readonly && (filp->f_mode & FMODE_WRITE)) {		rc = -EROFS;		goto err_open;	}	return 0;err_open:	ub_put(sc);	return rc;}
4520	/local/tlutelli/issta_data/temp/c/2005_temp/2005/4520/f4800078d9ed4bd20b1b27f56e7b68cfa0d73038/ub.c/clean/drivers/block/ub.c