Skip to contentSkip to conversation

+ ipc-change-kern_ipc_permdeleted-type-to-bool.patch added to -mm tree

PATCH [email protected] 1 participant 1 message Dec 19, 2013

lore
Share & tools
lore
#0 lore raw

Subject: + ipc-change-kern_ipc_permdeleted-type-to-bool.patch added to -mm tree
To: [email protected],[email protected],[email protected],[email protected],[email protected]
From: [email protected]
Date: Thu, 19 Dec 2013 14:15:06 -0800

The patch titled
Subject: ipc: change kern_ipc_perm.deleted type to bool
has been added to the -mm tree. Its filename is
ipc-change-kern_ipc_permdeleted-type-to-bool.patch

This patch should soon appear at
http://ozlabs.org/~akpm/mmots/broken-out/ipc-change-kern_ipc_permdeleted-type-to-bool.patch
and later at
http://ozlabs.org/~akpm/mmotm/broken-out/ipc-change-kern_ipc_permdeleted-type-to-bool.patch

Before you just go and hit "reply", please:
a) Consider who else should be cc'ed
b) Prefer to cc a suitable mailing list as well
c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's

*** Remember to use Documentation/SubmitChecklist when testing your code ***

The -mm tree is included into linux-next and is updated there every 3-4 working days

------------------------------------------------------
From: Rafael Aquini <[email protected]>
Subject: ipc: change kern_ipc_perm.deleted type to bool

struct kern_ipc_perm.deleted is meant to be used as a boolean toggle, and the changes introduced by this patch are just to make the case explicit.

---

 include/linux/ipc.h |    2 +-
 ipc/sem.c           |    2 +-
 ipc/util.c          |    6 +++---
 ipc/util.h          |    2 +-
 4 files changed, 6 insertions(+), 6 deletions(-)
include/linux/ipc.h renamed from include/linux/ipc.h~ipc-change-kern_ipc_permdeleted-type-to-bool +1 -1
diff -puN include/linux/ipc.h~ipc-change-kern_ipc_permdeleted-type-to-bool include/linux/ipc.h
@@ -11,7 +11,7 @@
 struct kern_ipc_perm
 {
 	spinlock_t	lock;
-	int		deleted;
+	bool		deleted;
 	int		id;
 	key_t		key;
 	kuid_t		uid;
ipc/sem.c renamed from ipc/sem.c~ipc-change-kern_ipc_permdeleted-type-to-bool +1 -1
diff -puN ipc/sem.c~ipc-change-kern_ipc_permdeleted-type-to-bool ipc/sem.c
@@ -394,7 +394,7 @@ static inline struct sem_array *sem_obta
 	/* ipc_rmid() may have already freed the ID while sem_lock
 	 * was spinning: verify that the structure is still valid
 	 */
-	if (!ipcp->deleted)
+	if (ipc_valid_object(ipcp))
 		return container_of(ipcp, struct sem_array, sem_perm);
 
 	sem_unlock(sma, *locknum);
ipc/util.c renamed from ipc/util.c~ipc-change-kern_ipc_permdeleted-type-to-bool +3 -3
diff -puN ipc/util.c~ipc-change-kern_ipc_permdeleted-type-to-bool ipc/util.c
@@ -286,7 +286,7 @@ int ipc_addid(struct ipc_ids* ids, struc
 	idr_preload(GFP_KERNEL);
 
 	spin_lock_init(&new->lock);
-	new->deleted = 0;
+	new->deleted = false;
 	rcu_read_lock();
 	spin_lock(&new->lock);
 
@@ -447,7 +447,7 @@ void ipc_rmid(struct ipc_ids *ids, struc
 
 	ids->in_use--;
 
-	ipcp->deleted = 1;
+	ipcp->deleted = true;
 
 	return;
 }
@@ -657,7 +657,7 @@ struct kern_ipc_perm *ipc_lock(struct ip
 	/* ipc_rmid() may have already freed the ID while ipc_lock
 	 * was spinning: here verify that the structure is still valid
 	 */
-	if (!out->deleted)
+	if (ipc_valid_object(out))
 		return out;
 
 	spin_unlock(&out->lock);
ipc/util.h renamed from ipc/util.h~ipc-change-kern_ipc_permdeleted-type-to-bool +1 -1
diff -puN ipc/util.h~ipc-change-kern_ipc_permdeleted-type-to-bool ipc/util.h
@@ -195,7 +195,7 @@ static inline void ipc_unlock(struct ker
  */
 static inline bool ipc_valid_object(struct kern_ipc_perm *perm)
 {
-	return perm->deleted == 0;
+	return !perm->deleted;
 }
 
 struct kern_ipc_perm *ipc_obtain_object_check(struct ipc_ids *ids, int id);

_

Patches currently in -mm which might be from [email protected] are

origin.patch mm-migrate-add-comment-about-permanent-failure-path.patch mm-migrate-correct-failure-handling-if-hugepage_migration_support.patch mm-migrate-remove-putback_lru_pages-fix-comment-on-putback_movable_pages.patch mm-migrate-remove-unused-function-fail_migrate_page.patch ipc-introduce-ipc_valid_object-helper-to-sort-out-ipc_rmid-races.patch ipc-change-kern_ipc_permdeleted-type-to-bool.patch