linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] quota: add missing use of dq_data_lock in __dquot_initialize
@ 2013-02-27 19:43 Jeff Mahoney
  2013-03-01  9:35 ` Jan Kara
  0 siblings, 1 reply; 2+ messages in thread
From: Jeff Mahoney @ 2013-02-27 19:43 UTC (permalink / raw)
  To: Linux FS Maling List; +Cc: Jan Kara

The bulk of __dquot_initialize runs under the dqptr_sem which
protects the inode->i_dquot pointers. It doesn't protect the
dereferenced contents, though. Those are protected by the
dq_data_lock, which is missing around the dquot_resv_space call.

Cc: Jan Kara <jack@suse.com>
Signed-off-by: Jeff Mahoney <jeffm@suse.com>
--

 fs/quota/dquot.c |    5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

--- a/fs/quota/dquot.c
+++ b/fs/quota/dquot.c
@@ -1439,8 +1439,11 @@ static void __dquot_initialize(struct in
 			 * did a write before quota was turned on
 			 */
 			rsv = inode_get_rsv_space(inode);
-			if (unlikely(rsv))
+			if (unlikely(rsv)) {
+				spin_lock(&dq_data_lock);
 				dquot_resv_space(inode->i_dquot[cnt], rsv);
+				spin_unlock(&dq_data_lock);
+			}
 		}
 	}
 out_err:

-- 
Jeff Mahoney
SUSE Labs

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2013-03-01  9:35 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-02-27 19:43 [PATCH] quota: add missing use of dq_data_lock in __dquot_initialize Jeff Mahoney
2013-03-01  9:35 ` Jan Kara

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).