From: Artem Bityutskiy <dedekind1@gmail.com>
To: Dongsheng Yang <yangds.fnst@cn.fujitsu.com>,
richard@nod.at, linux-mtd@lists.infradead.org
Subject: Re: [PATCH v3] ubifs: make ubifs_[get|set]xattr atomic
Date: Tue, 11 Aug 2015 15:57:15 +0300 [thread overview]
Message-ID: <1439297835.31419.31.camel@gmail.com> (raw)
In-Reply-To: <1438927640-14931-1-git-send-email-yangds.fnst@cn.fujitsu.com>
On Fri, 2015-08-07 at 14:07 +0800, Dongsheng Yang wrote:
> + mutex_lock(&ui->ui_mutex);
> kfree(ui->data);
> ui->data = kmemdup(value, size, GFP_NOFS);
> if (!ui->data) {
> + mutex_unlock(&ui->ui_mutex);
> err = -ENOMEM;
> goto out_free;
> }
> inode->i_size = ui->ui_size = size;
> ui->data_len = size;
> + mutex_unlock(&ui->ui_mutex);
Just one note - should kmemdup() be called outside of the critical
section, to make is shorter (memory allocation is a potentially slow
operation)?
Something like:
buf = kmemdup()
mutex_lock()
kfree(ui->data)
ui->data = buf
mutex_unlock()
Artem.
next prev parent reply other threads:[~2015-08-11 12:57 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-07-30 5:37 [PATCH] ubifs: make ubifs_[get|set]xattr atomic Dongsheng Yang
2015-07-30 8:05 ` Richard Weinberger
2015-07-31 0:04 ` Dongsheng Yang
2015-07-31 1:12 ` [PATCH v2] " Dongsheng Yang
2015-08-03 20:27 ` Richard Weinberger
2015-08-07 5:40 ` Dongsheng Yang
2015-08-07 6:07 ` [PATCH v3] " Dongsheng Yang
2015-08-10 8:05 ` Artem Bityutskiy
2015-08-11 3:32 ` Dongsheng Yang
2015-08-11 12:46 ` Artem Bityutskiy
2015-08-12 2:37 ` Dongsheng Yang
2015-08-11 12:57 ` Artem Bityutskiy [this message]
2015-08-12 2:37 ` Dongsheng Yang
2015-08-08 20:34 ` [PATCH v2] " Richard Weinberger
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1439297835.31419.31.camel@gmail.com \
--to=dedekind1@gmail.com \
--cc=linux-mtd@lists.infradead.org \
--cc=richard@nod.at \
--cc=yangds.fnst@cn.fujitsu.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).