All of lore.kernel.org
 help / color / mirror / Atom feed
From: Davidlohr Bueso <dave@stgolabs.net>
To: akpm@linux-foundation.org
Cc: manfred@colorfullife.com, dave@stgolabs.net,
	linux-kernel@vger.kernel.org, Davidlohr Bueso <dbueso@suse.de>
Subject: [PATCH 2/4] sysvipc: duplicate lock comments wrt ipc_addid()
Date: Thu, 31 Aug 2017 10:20:47 -0700	[thread overview]
Message-ID: <20170831172049.14576-3-dave@stgolabs.net> (raw)
In-Reply-To: <20170831172049.14576-1-dave@stgolabs.net>

The comment in msgqueues when using ipc_addid() is quite
useful imo. Duplicate it for shm and semaphores.

Signed-off-by: Davidlohr Bueso <dbueso@suse.de>
---
 ipc/sem.c | 1 +
 ipc/shm.c | 1 +
 2 files changed, 2 insertions(+)

diff --git a/ipc/sem.c b/ipc/sem.c
index 013c7981f3c7..29c6ab6badc2 100644
--- a/ipc/sem.c
+++ b/ipc/sem.c
@@ -514,6 +514,7 @@ static int newary(struct ipc_namespace *ns, struct ipc_params *params)
 	sma->sem_nsems = nsems;
 	sma->sem_ctime = get_seconds();
 
+	/* ipc_addid() locks sma upon success. */
 	retval = ipc_addid(&sem_ids(ns), &sma->sem_perm, ns->sc_semmni);
 	if (retval < 0) {
 		call_rcu(&sma->sem_perm.rcu, sem_rcu_free);
diff --git a/ipc/shm.c b/ipc/shm.c
index 8fc97beb5234..ea64ed8782b3 100644
--- a/ipc/shm.c
+++ b/ipc/shm.c
@@ -600,6 +600,7 @@ static int newseg(struct ipc_namespace *ns, struct ipc_params *params)
 	shp->shm_file = file;
 	shp->shm_creator = current;
 
+	/* ipc_addid() locks shp upon success. */
 	error = ipc_addid(&shm_ids(ns), &shp->shm_perm, ns->shm_ctlmni);
 	if (error < 0)
 		goto no_id;
-- 
2.12.0

  parent reply	other threads:[~2017-08-31 17:21 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-08-31 17:20 [PATCH -next 0/4] sysvipc: ipc-key management improvements Davidlohr Bueso
2017-08-31 17:20 ` [PATCH 1/4] sysvipc: unteach ids->next_id for !CHECKPOINT_RESTORE Davidlohr Bueso
2017-10-03 22:03   ` Andrew Morton
2017-08-31 17:20 ` Davidlohr Bueso [this message]
2017-08-31 17:20 ` [PATCH 3/4] sysvipc: properly name ipc_addid() limit parameter Davidlohr Bueso
2017-08-31 17:20 ` [PATCH 4/4] sysvipc: make get_maxid O(1) again Davidlohr Bueso
2017-08-31 17:37   ` Davidlohr Bueso

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=20170831172049.14576-3-dave@stgolabs.net \
    --to=dave@stgolabs.net \
    --cc=akpm@linux-foundation.org \
    --cc=dbueso@suse.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=manfred@colorfullife.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 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.