From: Dmitry Bogdanov <d.bogdanov@yadro.com>
To: <michael.christie@oracle.com>
Cc: Martin Petersen <martin.petersen@oracle.com>,
<target-devel@vger.kernel.org>, <linux-scsi@vger.kernel.org>,
<linux@yadro.com>
Subject: Re: [PATCH 7/7] target: core: check RTPI uniquity for enabled TPG
Date: Tue, 4 Oct 2022 19:41:52 +0300 [thread overview]
Message-ID: <20221004164152.GE10901@yadro.com> (raw)
In-Reply-To: <f4d08857-204e-f0ff-600f-8e8c87b6a02d@oracle.com>
On Sat, Oct 01, 2022 at 11:19:45AM -0500, michael.christie@oracle.com wrote:
>
> On 9/29/22 7:02 PM, Mike Christie wrote:
> > On 9/6/22 10:45 AM, Dmitry Bogdanov wrote:
> >> Garantee uniquity of RTPI only for enabled target port groups.
> >> Allow any RPTI for disabled tpg until it is enabled.
> >>
> >> Signed-off-by: Dmitry Bogdanov <d.bogdanov@yadro.com>
> >> ---
> >> drivers/target/target_core_fabric_configfs.c | 29 +++++++++++++-
> >> drivers/target/target_core_internal.h | 2 +
> >> drivers/target/target_core_tpg.c | 40 +++++++++++++-------
> >> 3 files changed, 56 insertions(+), 15 deletions(-)
> >>
> >> diff --git a/drivers/target/target_core_fabric_configfs.c b/drivers/target/target_core_fabric_configfs.c
> >> index a34b5db4eec5..fc1b8f54fb54 100644
> >> --- a/drivers/target/target_core_fabric_configfs.c
> >> +++ b/drivers/target/target_core_fabric_configfs.c
> >> @@ -857,6 +857,7 @@ static ssize_t target_fabric_tpg_base_enable_store(struct config_item *item,
> >> size_t count)
> >> {
> >> struct se_portal_group *se_tpg = to_tpg(item);
> >> + struct se_portal_group *tpg;
> >> int ret;
> >> bool op;
> >>
> >> @@ -867,11 +868,37 @@ static ssize_t target_fabric_tpg_base_enable_store(struct config_item *item,
> >> if (se_tpg->enabled == op)
> >> return count;
> >>
> >> + spin_lock(&g_tpg_lock);
> >> +
> >> + if (op) {
> >> + tpg = core_get_tpg_by_rtpi(se_tpg->tpg_rtpi);
> >> + if (tpg) {
> >> + spin_unlock(&g_tpg_lock);
> >> +
> >> + pr_err("TARGET_CORE[%s]->TPG[%u] - RTPI %#x conflicts with TARGET_CORE[%s]->TPG[%u]\n",
> >> + se_tpg->se_tpg_tfo->fabric_name,
> >> + se_tpg->se_tpg_tfo->tpg_get_tag(tpg),
> >> + se_tpg->tpg_rtpi,
> >> + tpg->se_tpg_tfo->fabric_name,
> >> + tpg->se_tpg_tfo->tpg_get_tag(tpg));
> >> + return -EINVAL;
> >> + }
> >> + }
> >> +
> >> + se_tpg->enabled |= 0x10; /* transient state */
> >
> > Just use a mutex and hold it the entire time if
> I was looking at the configfs code and am now not sure what the transient state
> is for. It looks like when doing a read or write configfs holds the buffer->mutex,
> so I don't think userspace would ever see the transient state.
>
> Can you just drop it?
sysfs lock is per file, so 'enable' and 'rtpi' files can be written in
parallel. But after rewriting of the patchset, this part will be
dropped.
next prev parent reply other threads:[~2022-10-04 16:42 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-09-06 15:45 [PATCH 0/7] scsi: target: make RTPI an TPG identifier Dmitry Bogdanov
2022-09-06 15:45 ` [PATCH 1/7] scsi: target: core: Add cleanup sequence in core_tpg_register() Dmitry Bogdanov
2022-09-06 15:45 ` [PATCH 2/7] scsi: target: core: Add RTPI field to target port Dmitry Bogdanov
2022-09-29 22:26 ` Mike Christie
2022-09-29 23:57 ` Mike Christie
2022-10-04 16:11 ` Dmitry Bogdanov
2022-09-06 15:45 ` [PATCH 3/7] scsi: target: core: Use RTPI from " Dmitry Bogdanov
2022-09-06 15:45 ` [PATCH 4/7] scsi: target: core: Drop device-based RTPI Dmitry Bogdanov
2022-09-06 15:45 ` [PATCH 5/7] scsi: target: core: Add common port attributes Dmitry Bogdanov
2022-09-06 15:45 ` [PATCH 6/7] scsi: target: core: Add RTPI attribute for target port Dmitry Bogdanov
2022-09-30 0:03 ` Mike Christie
2022-10-04 16:12 ` Dmitry Bogdanov
2022-09-06 15:45 ` [PATCH 7/7] target: core: check RTPI uniquity for enabled TPG Dmitry Bogdanov
2022-09-30 0:02 ` Mike Christie
2022-10-01 16:19 ` michael.christie
2022-10-04 16:41 ` Dmitry Bogdanov [this message]
2022-10-04 16:37 ` Dmitry Bogdanov
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=20221004164152.GE10901@yadro.com \
--to=d.bogdanov@yadro.com \
--cc=linux-scsi@vger.kernel.org \
--cc=linux@yadro.com \
--cc=martin.petersen@oracle.com \
--cc=michael.christie@oracle.com \
--cc=target-devel@vger.kernel.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.