Date: Wed, 12 Jun 2013 09:07:15 +0000 (UTC) From: Alexander Motin <mav@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r251649 - in head/sys/cam: ata scsi Message-ID: <201306120907.r5C97FTN022047@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: mav Date: Wed Jun 12 09:07:15 2013 New Revision: 251649 URL: http://svnweb.freebsd.org/changeset/base/251649 Log: Acquire periph reference when handling d_getattr() method call. While GEOM in general has provider opened while sending BIO_GETATTR, GEOM DISK does not really need to open disk to read medium-unrelated attributes for own use. Proposed by: ken Modified: head/sys/cam/ata/ata_da.c head/sys/cam/scsi/scsi_da.c Modified: head/sys/cam/ata/ata_da.c ============================================================================== --- head/sys/cam/ata/ata_da.c Wed Jun 12 07:53:59 2013 (r251648) +++ head/sys/cam/ata/ata_da.c Wed Jun 12 09:07:15 2013 (r251649) @@ -1080,10 +1080,13 @@ adagetattr(struct bio *bp) struct cam_periph *periph; periph = (struct cam_periph *)bp->bio_disk->d_drv1; + if (cam_periph_acquire(periph) != CAM_REQ_CMP) + return (ENXIO); cam_periph_lock(periph); ret = xpt_getattr(bp->bio_data, bp->bio_length, bp->bio_attribute, periph->path); cam_periph_unlock(periph); + cam_periph_release(periph); if (ret == 0) bp->bio_completed = bp->bio_length; return ret; Modified: head/sys/cam/scsi/scsi_da.c ============================================================================== --- head/sys/cam/scsi/scsi_da.c Wed Jun 12 07:53:59 2013 (r251648) +++ head/sys/cam/scsi/scsi_da.c Wed Jun 12 09:07:15 2013 (r251649) @@ -1427,10 +1427,13 @@ dagetattr(struct bio *bp) struct cam_periph *periph; periph = (struct cam_periph *)bp->bio_disk->d_drv1; + if (cam_periph_acquire(periph) != CAM_REQ_CMP) + return (ENXIO); cam_periph_lock(periph); ret = xpt_getattr(bp->bio_data, bp->bio_length, bp->bio_attribute, periph->path); cam_periph_unlock(periph); + cam_periph_release(periph); if (ret == 0) bp->bio_completed = bp->bio_length; return ret;
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201306120907.r5C97FTN022047>