login
Login
/
Register
Search
Forums
News
Blogs
Features
Site
Home
»
Mailing list archives
»
linux-kernel
»
2008
»
May
»
22
Re: [PATCH] eCryptfs: Clean up kthread synchronization
view
thread
!MAILaRCHIVE_VOTE_RePLACE
Previous message: [
thread
] [
date
] [
author
]
Next message: [
thread
] [
date
] [
author
]
[view in full thread]
From:
Andrew Morton <akpm@...>
To: Michael Halcrow <mhalcrow@...>
Cc: <linux-kernel@...>, <prussell@...>, <shaggy@...>, <sergeh@...>
Subject:
Re: [PATCH] eCryptfs: Clean up kthread synchronization
Date: Thursday, May 22, 2008 - 3:41 pm
On Thu, 22 May 2008 14:31:55 -0500 Michael Halcrow <mhalcrow@us.ibm.com> wrote:
quoted text
> > > +void ecryptfs_destroy_kthread(void) > > > +{ > > > + struct ecryptfs_open_req tmp_req; > > > + struct ecryptfs_open_req *req; > > > + > > > + mutex_lock(&ecryptfs_kthread_ctl.mux); > > > + ecryptfs_kthread_ctl.flags |= ECRYPTFS_KTHREAD_ZOMBIE; > > > + list_for_each_entry(req, &ecryptfs_kthread_ctl.req_list, > > > + kthread_ctl_list) { > > > + mutex_lock(&req->mux); > > > + req->flags |= ECRYPTFS_REQ_ZOMBIE; > > > + wake_up_process(req->requesting_task); > > > + mutex_unlock(&req->mux); > > > + } > > > + memset(&tmp_req, 0, sizeof(tmp_req)); > > > + tmp_req.flags = ECRYPTFS_REQ_ZOMBIE; > > > + list_add_tail(&tmp_req.kthread_ctl_list, > > > + &ecryptfs_kthread_ctl.req_list); > > > + mutex_unlock(&ecryptfs_kthread_ctl.mux); > > > + wake_up(&ecryptfs_kthread_ctl.wait); > > > +} > > > > eh? We attach a local variable to a global list and then return? > > That won't last very long. > > Adding this dummy entry to the list is just my own way of getting the > kthread to wake up and shut down. This actually works, albeit a little > ugly. The list and its contents get dropped on the floor at this point > because (ecryptfs_kthread_ctl.flags & ECRYPTFS_KTHREAD_ZOMBIE). The > only consumer of this list (the kthread) checks for this flag > immediately after getting the mux, and if it is there, it just > exits. The only producer on this list (ecryptfs_privileged_open()) > checks for this flag immediately after getting the mux and bows out if > it is set. In other words, once this flag is set, the list and its > contents become untouchable by anything other than > ecryptfs_destroy_kthread().
Unconvinced. As soon as ecryptfs_destroy_kthread() returns, tmp_req is destroyed. But it remains on ecryptfs_kthread_ctl.req_list.
quoted text
> memset(&tmp_req, 0, sizeof(tmp_req)); > tmp_req.flags = ECRYPTFS_REQ_ZOMBIE; > list_add_tail(&tmp_req.kthread_ctl_list, > &ecryptfs_kthread_ctl.req_list); > mutex_unlock(&ecryptfs_kthread_ctl.mux); > wake_up(&ecryptfs_kthread_ctl.wait);
-> it's dead.
quoted text
> }
--
unsubscribe notice
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to
majordomo@vger.kernel.org
More majordomo info at
http://vger.kernel.org/majordomo-info.html
Please read the FAQ at
http://www.tux.org/lkml/
Previous message: [
thread
] [
date
] [
author
]
Next message: [
thread
] [
date
] [
author
]
Messages in current thread:
[PATCH] eCryptfs: Privileged kthread for lower file opens
, Michael Halcrow
, (Tue May 20, 5:46 pm)
Re: [PATCH] eCryptfs: Privileged kthread for lower file opens
, Andrew Morton
, (Wed May 21, 6:59 pm)
[PATCH] eCryptfs: Clean up kthread synchronization
, Michael Halcrow
, (Thu May 22, 3:31 pm)
Re: [PATCH] eCryptfs: Clean up kthread synchronization
, Andrew Morton
, (Thu May 22, 3:41 pm)
Re: [PATCH] eCryptfs: Clean up kthread synchronization
, Michael Halcrow
, (Thu May 22, 5:16 pm)
Re: [PATCH] eCryptfs: Clean up kthread synchronization
, Andrew Morton
, (Thu May 22, 6:03 pm)
[PATCH] eCryptfs: Use kthread_should_stop() instead of the n...
, Michael Halcrow
, (Thu May 22, 5:44 pm)
Re: [PATCH] eCryptfs: Privileged kthread for lower file opens
, Andrea Righi
, (Tue May 20, 7:16 pm)
Re: [PATCH] eCryptfs: Privileged kthread for lower file opens
, Michael Halcrow
, (Wed May 21, 11:14 am)
[PATCH] eCryptfs: Remove useless lock
, Michael Halcrow
, (Wed May 21, 11:39 am)
Navigation
Create content
Mailing list archives
Recent posts
Popular discussions
linux-kernel
:
debian developer
Re: Dual-Licensing Linux Kernel with GPL V2 and GPL V3
Greg KH
[GIT PATCH] driver core patches against 2.6.24
H. Peter Anvin
Re: [PATCH] x86: Construct 32 bit boot time page tables in native format.
Christoph Lameter
Re: [RFC 00/15] x86_64: Optimize percpu accesses
git
:
linux-netdev
:
Christoph Hellwig
Re: [PATCH 06/32] IGET: Mark iget() and read_inode() as being obsolete [try #2]
Jarek Poplawski
Re: [PATCH] pkt_sched: Destroy gen estimators under rtnl_lock().
Gerrit Renker
[PATCH 27/37] dccp: Integration of dynamic feature activation - part 2 (server side)
David Miller
[GIT]: Networking
openbsd-misc
:
Colocation donated by:
Who's online
There are currently
4 users
and
683 guests
online.
Online users
zeekec
passionplay0001
negociosores
christopherneal
Syndicate