From: Christoph Hellwig <hch@lst.de>
To: Douglas Gilbert <dgilbert@interlog.com>
Cc: SCSI development list <linux-scsi@vger.kernel.org>,
James Bottomley <james.bottomley@hansenpartnership.com>,
Hannes Reinecke <hare@suse.de>, vaughan <vaughan.cao@oracle.com>
Subject: Re: [PATCH v4] sg: O_EXCL and other lock handling
Date: Mon, 16 Jun 2014 15:45:16 +0200 [thread overview]
Message-ID: <20140616134516.GB11926@lst.de> (raw)
In-Reply-To: <539B0BC1.2020303@interlog.com>
On Fri, Jun 13, 2014 at 10:33:37AM -0400, Douglas Gilbert wrote:
>> this looks generally good to me, but I don't think open_cnt and exclude
>> have to use atomic_t, as they are only ever modified under open_rel_lock.
>
> They are read by 'cat /proc/scsi/sg/debug' [in
> sg_proc_seq_show_debug()] but transient off-by-1 reports
> are not so important. [Prior to locking that block with
> read_lock(sfd_lock) that routine sometimes printed wild
> results, so some care is required.]
In general 32-bit variables that can be read independly only need the lock
for updates. A lock on the read side is important if variables are of
a type that can't be atomically read (e.g. 64-bit on 32-bit architectures,
or small integers on some old alpha CPUs), or if the values of multiple
variables need to be consistent for the reader.
>> Can you take a look at the version below? This changes open_cnt to an
>> int, exclude to a bool, removes the open_cnt underflow check that
>> the VFS takes care for, and streamlines the open path a little bit:
>
> sg_open() and sg_release() clean-up looks good. The
> back-up goto at the end of sg_open() reminds me of
> Fortran style :-) More importantly my sg_tst_excl*
> tests give this version the thumbs up.
>
> Acked-by: Douglas Gilbert <dgilbert@interlog.com>
Given that this was your patch with minor changes I was planning to put
this in under your name if that's fine with you.
I'm also looking for another review.
next prev parent reply other threads:[~2014-06-16 13:45 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-06-13 0:26 [PATCH v4] sg: O_EXCL and other lock handling Douglas Gilbert
2014-06-13 9:03 ` Christoph Hellwig
2014-06-13 14:33 ` Douglas Gilbert
2014-06-16 13:45 ` Christoph Hellwig [this message]
2014-06-13 20:18 ` Douglas Gilbert
2014-06-21 11:01 ` Hannes Reinecke
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=20140616134516.GB11926@lst.de \
--to=hch@lst.de \
--cc=dgilbert@interlog.com \
--cc=hare@suse.de \
--cc=james.bottomley@hansenpartnership.com \
--cc=linux-scsi@vger.kernel.org \
--cc=vaughan.cao@oracle.com \
/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