Re: [f2fs-dev] [PATCH] f2fs crypto: add rwsem to avoid data races

2015-05-20 Thread Theodore Ts'o
On Tue, May 19, 2015 at 09:55:54PM -0700, Jaegeuk Kim wrote: > > Looking at a glance, it's mostly same as what I wanted. The key is to share > ci->ci_ctfm for regular file and the other dir/symlink files. > So, ext4_get_encryption_info will handle most of cases. Yeah, I noticed after sending out

Re: [f2fs-dev] [PATCH] f2fs crypto: add rwsem to avoid data races

2015-05-19 Thread Jaegeuk Kim
On Wed, May 20, 2015 at 12:35:18AM -0400, Theodore Ts'o wrote: > On Tue, May 19, 2015 at 05:38:59PM -0700, Jaegeuk Kim wrote: > > > > What I'm saying is writer vs writer actually. > > This is a rough draft of what I had in mind. This fixes the tfm > allocation issue in the writepage path, as wel

Re: [f2fs-dev] [PATCH] f2fs crypto: add rwsem to avoid data races

2015-05-19 Thread Theodore Ts'o
On Tue, May 19, 2015 at 05:38:59PM -0700, Jaegeuk Kim wrote: > > What I'm saying is writer vs writer actually. This is a rough draft of what I had in mind. This fixes the tfm allocation issue in the writepage path, as well as using a lockless cmpxchg algorithm to address the race you were concer

Re: [f2fs-dev] [PATCH] f2fs crypto: add rwsem to avoid data races

2015-05-19 Thread Jaegeuk Kim
On Tue, May 19, 2015 at 10:35:30AM -0400, nick wrote: > > > On 2015-05-19 10:29 AM, Theodore Ts'o wrote: > > On Mon, May 18, 2015 at 10:36:41PM -0700, Jaegeuk Kim wrote: > >> Previoulsy, fi->i_crypt_info was not covered by any lock, resulting in > >> memory leak. > >> > >> This patch adds a rwsem

Re: [PATCH] f2fs crypto: add rwsem to avoid data races

2015-05-19 Thread Jaegeuk Kim
On Tue, May 19, 2015 at 10:29:43AM -0400, Theodore Ts'o wrote: > On Mon, May 18, 2015 at 10:36:41PM -0700, Jaegeuk Kim wrote: > > Previoulsy, fi->i_crypt_info was not covered by any lock, resulting in > > memory leak. > > > > This patch adds a rwsem to avoid leaking objects on i_crypt_info. > > >

Re: [PATCH] f2fs crypto: add rwsem to avoid data races

2015-05-19 Thread Theodore Ts'o
On Mon, May 18, 2015 at 10:36:41PM -0700, Jaegeuk Kim wrote: > Previoulsy, fi->i_crypt_info was not covered by any lock, resulting in > memory leak. > > This patch adds a rwsem to avoid leaking objects on i_crypt_info. > > Signed-off-by: Jaegeuk Kim I'm not sure we need an rwsem to fix this iss

[PATCH] f2fs crypto: add rwsem to avoid data races

2015-05-18 Thread Jaegeuk Kim
Previoulsy, fi->i_crypt_info was not covered by any lock, resulting in memory leak. This patch adds a rwsem to avoid leaking objects on i_crypt_info. Signed-off-by: Jaegeuk Kim --- fs/f2fs/crypto_key.c | 29 ++--- fs/f2fs/f2fs.h | 1 + fs/f2fs/super.c | 1 +