From: Andi Kleen <andi@firstfloor.org>
To: Arne Jansen <sensille@gmx.net>
Cc: chris.mason@oracle.com, linux-btrfs@vger.kernel.org
Subject: Re: [PATCH v0 17/18] btrfs: add qgroup ioctls
Date: Thu, 06 Oct 2011 13:40:35 -0700 [thread overview]
Message-ID: <m2pqi93lbw.fsf@firstfloor.org> (raw)
In-Reply-To: <0344fa710f60981488cd3b6583a88c81d507acfd.1317915011.git.sensille@gmx.net> (Arne Jansen's message of "Thu, 6 Oct 2011 17:54:27 +0200")
Arne Jansen <sensille@gmx.net> writes:
> +
> + if (copy_to_user(arg, sa, sizeof(*sa)))
> + ret = -EFAULT;
> +
> + if (trans) {
> + err = btrfs_commit_transaction(trans, root);
> + if (err && !ret)
> + ret = err;
> + }
It would seem safer to put the copy to user outside the transaction.
A cto can in principle cause new writes (e.g. if it causes COW), so
you may end up with nested transactions. Even if that works somehow
(not sure) it seems to be a thing better avoided.
> +
> + sa = memdup_user(arg, sizeof(*sa));
> + if (IS_ERR(sa))
> + return PTR_ERR(sa);
> +
> + trans = btrfs_join_transaction(root);
> + if (IS_ERR(trans)) {
> + ret = PTR_ERR(trans);
> + goto out;
> + }
This code seems to be duplicated a lot. Can it be consolidated?
-Andi
--
ak@linux.intel.com -- Speaking for myself only
next prev parent reply other threads:[~2011-10-06 20:40 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-10-06 15:54 [PATCH v0 00/18] btfs: Subvolume Quota Groups Arne Jansen
2011-10-06 15:54 ` [PATCH v0 01/18] btrfs: mark delayed refs as for cow Arne Jansen
2011-10-06 15:54 ` [PATCH v0 02/18] btrfs: always save ref_root in delayed refs Arne Jansen
2011-10-06 15:54 ` [PATCH v0 03/18] btrfs: add nested locking mode for paths Arne Jansen
2011-10-06 20:36 ` Andi Kleen
[not found] ` <CANvN+ems8D+wB_YPzoNpsqxZ8on-z7xCEXQuQ0LgoF_T=gw+Yw@mail.gmail.com>
[not found] ` <CANvN+emRvTQD-epGJrELs_WAF06zuuBb0ELpSFrGazzAbo29gg@mail.gmail.com>
2011-10-06 20:50 ` Andi Kleen
[not found] ` <CANvN+e=GtjwG9+G1BggsbQOwe+iP4DzqQUvjDP=rw_+FuPZM7w@mail.gmail.com>
2011-10-07 8:39 ` Arne Jansen
2011-10-06 15:54 ` [PATCH v0 04/18] btrfs: qgroup on-disk format Arne Jansen
2011-10-06 15:54 ` [PATCH v0 05/18] btrfs: add helper for tree enumeration Arne Jansen
2011-10-06 15:54 ` [PATCH v0 06/18] btrfs: check the root passed to btrfs_end_transaction Arne Jansen
2011-10-06 15:54 ` [PATCH v0 07/18] btrfs: generic data structure to build unique lists Arne Jansen
2011-10-06 20:33 ` Andi Kleen
2011-10-06 22:19 ` David Sterba
2011-10-07 8:12 ` Arne Jansen
2011-10-07 15:07 ` Andi Kleen
2011-10-06 15:54 ` [PATCH v0 08/18] btrfs: added helper to create new trees Arne Jansen
2011-10-06 15:54 ` [PATCH v0 09/18] btrfs: qgroup state and initialization Arne Jansen
2011-10-06 15:54 ` [PATCH v0 10/18] btrfs: Test code to change the order of delayed-ref processing Arne Jansen
2011-10-06 15:54 ` [PATCH v0 11/18] btrfs: add sequence numbers to delayed refs Arne Jansen
2011-10-06 15:54 ` [PATCH v0 12/18] btrfs: put back delayed refs that are too new Arne Jansen
2011-10-06 15:54 ` [PATCH v0 13/18] btrfs: qgroup implementation and prototypes Arne Jansen
2011-10-06 15:54 ` [PATCH v0 14/18] btrfs: quota tree support and startup Arne Jansen
2011-10-06 15:54 ` [PATCH v0 15/18] btrfs: hooks for qgroup to record delayed refs Arne Jansen
2011-10-06 15:54 ` [PATCH v0 16/18] btrfs: hooks to reserve qgroup space Arne Jansen
2011-10-06 15:54 ` [PATCH v0 17/18] btrfs: add qgroup ioctls Arne Jansen
2011-10-06 20:40 ` Andi Kleen [this message]
2011-10-06 15:54 ` [PATCH v0 18/18] btrfs: add qgroup inheritance Arne Jansen
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=m2pqi93lbw.fsf@firstfloor.org \
--to=andi@firstfloor.org \
--cc=chris.mason@oracle.com \
--cc=linux-btrfs@vger.kernel.org \
--cc=sensille@gmx.net \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.