aboutsummaryrefslogtreecommitdiffstats
path: root/ipc/util.c
diff options
context:
space:
mode:
authorNadia Derbey <Nadia.Derbey@bull.net>2008-07-25 04:48:03 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2008-07-25 13:53:42 -0400
commit00c2bf85d8febfcfddde63822043462b026134ff (patch)
tree25dbdf6d713408da992eace1168c45244d13c2a7 /ipc/util.c
parent983bfb7db303cfde56ae5bbf4e0f2f46e38c9576 (diff)
ipc: get rid of ipc_lock_down()
Remove the ipc_lock_down() routines: they used to call idr_find() locklessly (given that the ipc ids lock was already held), so they are not needed anymore. Signed-off-by: Nadia Derbey <Nadia.Derbey@bull.net> Acked-by: "Paul E. McKenney" <paulmck@us.ibm.com> Cc: Manfred Spraul <manfred@colorfullife.com> Cc: Jim Houston <jim.houston@comcast.net> Cc: Pierre Peiffer <peifferp@gmail.com> Acked-by: Rik van Riel <riel@redhat.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'ipc/util.c')
-rw-r--r--ipc/util.c52
1 files changed, 1 insertions, 51 deletions
diff --git a/ipc/util.c b/ipc/util.c
index 0f468c34e83c..49b3ea615dc5 100644
--- a/ipc/util.c
+++ b/ipc/util.c
@@ -716,56 +716,6 @@ struct kern_ipc_perm *ipc_lock(struct ipc_ids *ids, int id)
716 return out; 716 return out;
717} 717}
718 718
719/**
720 * ipc_lock_down - Lock an ipc structure with rw_sem held
721 * @ids: IPC identifier set
722 * @id: ipc id to look for
723 *
724 * Look for an id in the ipc ids idr and lock the associated ipc object.
725 *
726 * The ipc object is locked on exit.
727 *
728 * This is the routine that should be called when the rw_mutex is already
729 * held, i.e. idr tree protected.
730 */
731
732struct kern_ipc_perm *ipc_lock_down(struct ipc_ids *ids, int id)
733{
734 struct kern_ipc_perm *out;
735 int lid = ipcid_to_idx(id);
736
737 rcu_read_lock();
738 out = idr_find(&ids->ipcs_idr, lid);
739 if (out == NULL) {
740 rcu_read_unlock();
741 return ERR_PTR(-EINVAL);
742 }
743
744 spin_lock(&out->lock);
745
746 /*
747 * No need to verify that the structure is still valid since the
748 * rw_mutex is held.
749 */
750 return out;
751}
752
753struct kern_ipc_perm *ipc_lock_check_down(struct ipc_ids *ids, int id)
754{
755 struct kern_ipc_perm *out;
756
757 out = ipc_lock_down(ids, id);
758 if (IS_ERR(out))
759 return out;
760
761 if (ipc_checkid(out, id)) {
762 ipc_unlock(out);
763 return ERR_PTR(-EIDRM);
764 }
765
766 return out;
767}
768
769struct kern_ipc_perm *ipc_lock_check(struct ipc_ids *ids, int id) 719struct kern_ipc_perm *ipc_lock_check(struct ipc_ids *ids, int id)
770{ 720{
771 struct kern_ipc_perm *out; 721 struct kern_ipc_perm *out;
@@ -837,7 +787,7 @@ struct kern_ipc_perm *ipcctl_pre_down(struct ipc_ids *ids, int id, int cmd,
837 int err; 787 int err;
838 788
839 down_write(&ids->rw_mutex); 789 down_write(&ids->rw_mutex);
840 ipcp = ipc_lock_check_down(ids, id); 790 ipcp = ipc_lock_check(ids, id);
841 if (IS_ERR(ipcp)) { 791 if (IS_ERR(ipcp)) {
842 err = PTR_ERR(ipcp); 792 err = PTR_ERR(ipcp);
843 goto out_up; 793 goto out_up;