From: Dan Carpenter <dan.carpenter@oracle.com>
To: lustre-devel@lists.lustre.org
Subject: [lustre-devel] [PATCH 1/3] staging:lustre: remove tcpip abstraction from libcfs
Date: Fri, 22 May 2015 14:15:36 +0300 [thread overview]
Message-ID: <20150522111536.GA19434@mwanda> (raw)
In-Reply-To: <1432248378-28912-2-git-send-email-jsimmons@infradead.org>
This patch does a lot of stuff all at once and it is hard to review. It
could easily be broken into patches which are easy to review.
> @@ -1378,15 +1378,15 @@ ksocknal_create_conn(lnet_ni_t *ni, ksock_route_t *route,
> ksocknal_txlist_done(ni, &zombies, 1);
> ksocknal_peer_decref(peer);
>
> - failed_1:
> +failed_1:
Do unrelated white space changes in a different patch. It just makes
reviewing complicated to mix easy to review white space changes in with
everything else.
> if (hello != NULL)
> LIBCFS_FREE(hello, offsetof(ksock_hello_msg_t,
> kshm_ips[LNET_MAX_INTERFACES]));
>
> LIBCFS_FREE(conn, sizeof(*conn));
>
> - failed_0:
> - libcfs_sock_release(sock);
> +failed_0:
> + sock_release(sock);
Do a rename patch by itself. You can rename a bunch of functions at the
same time, that's fine. Personally, you can even move the functions
between files, that's also fine with me and doesn't complicate my
review.
Ok in this next section we move functions around and rename them but
also introduce some bad changes in the new function.
> +static int
> +lnet_sock_ioctl(int cmd, unsigned long arg)
> +{
> + struct file *sock_filp;
> + struct socket *sock;
> + int fd = -1;
> + int rc;
> +
> + rc = sock_create(PF_INET, SOCK_STREAM, 0, &sock);
> + if (rc != 0) {
> + CERROR("Can't create socket: %d\n", rc);
> + return rc;
> + }
> +
> + sock_filp = sock_alloc_file(sock, 0, NULL);
> + if (!sock_filp) {
sock_alloc_file() never returns NULL, only valid pointers on success or
ERR_PTRs on failue.
> + rc = -ENOMEM;
> + sock_release(sock);
> + goto out;
> + }
> +
> + rc = kernel_sock_unlocked_ioctl(sock_filp, cmd, arg);
This is an unrelated cleanup. Do it in a different patch.
> +
> + fput(sock_filp);
> +out:
> + if (fd >= 0)
> + sys_close(fd);
This is a new change as well. "fd" is always -1 so this is dead code.
> + return rc;
> +}
> +
Here is the old function:
> -static int
> -libcfs_sock_ioctl(int cmd, unsigned long arg)
> -{
> - mm_segment_t oldmm = get_fs();
> - struct socket *sock;
> - int rc;
> - struct file *sock_filp;
> -
> - rc = sock_create (PF_INET, SOCK_STREAM, 0, &sock);
> - if (rc != 0) {
> - CERROR ("Can't create socket: %d\n", rc);
> - return rc;
> - }
> -
> - sock_filp = sock_alloc_file(sock, 0, NULL);
> - if (IS_ERR(sock_filp)) {
This check was correct in the original.
> - sock_release(sock);
> - rc = PTR_ERR(sock_filp);
> - goto out;
> - }
> -
> - set_fs(KERNEL_DS);
> - if (sock_filp->f_op->unlocked_ioctl)
> - rc = sock_filp->f_op->unlocked_ioctl(sock_filp, cmd, arg);
> - set_fs(oldmm);
> -
> - fput(sock_filp);
> -out:
> - return rc;
> -}
This patch has some bug fixes as well. Those should be sent as one
patch per bugfix with a proper changelog.
regards,
dan carpenter
WARNING: multiple messages have this Message-ID (diff)
From: Dan Carpenter <dan.carpenter@oracle.com>
To: James Simmons <jsimmons@infradead.org>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
devel@driverdev.osuosl.org, Oleg Drokin <oleg.drokin@intel.com>,
Andreas Dilger <andreas.dilger@intel.com>,
HPDD-discuss@ml01.01.org, James Simmons <uja.ornl@gmail.com>,
James Simmons <uja.ornl@yahoo.com>,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
lustre-devel@lists.lustre.org
Subject: Re: [PATCH 1/3] staging:lustre: remove tcpip abstraction from libcfs
Date: Fri, 22 May 2015 14:15:36 +0300 [thread overview]
Message-ID: <20150522111536.GA19434@mwanda> (raw)
In-Reply-To: <1432248378-28912-2-git-send-email-jsimmons@infradead.org>
This patch does a lot of stuff all at once and it is hard to review. It
could easily be broken into patches which are easy to review.
> @@ -1378,15 +1378,15 @@ ksocknal_create_conn(lnet_ni_t *ni, ksock_route_t *route,
> ksocknal_txlist_done(ni, &zombies, 1);
> ksocknal_peer_decref(peer);
>
> - failed_1:
> +failed_1:
Do unrelated white space changes in a different patch. It just makes
reviewing complicated to mix easy to review white space changes in with
everything else.
> if (hello != NULL)
> LIBCFS_FREE(hello, offsetof(ksock_hello_msg_t,
> kshm_ips[LNET_MAX_INTERFACES]));
>
> LIBCFS_FREE(conn, sizeof(*conn));
>
> - failed_0:
> - libcfs_sock_release(sock);
> +failed_0:
> + sock_release(sock);
Do a rename patch by itself. You can rename a bunch of functions at the
same time, that's fine. Personally, you can even move the functions
between files, that's also fine with me and doesn't complicate my
review.
Ok in this next section we move functions around and rename them but
also introduce some bad changes in the new function.
> +static int
> +lnet_sock_ioctl(int cmd, unsigned long arg)
> +{
> + struct file *sock_filp;
> + struct socket *sock;
> + int fd = -1;
> + int rc;
> +
> + rc = sock_create(PF_INET, SOCK_STREAM, 0, &sock);
> + if (rc != 0) {
> + CERROR("Can't create socket: %d\n", rc);
> + return rc;
> + }
> +
> + sock_filp = sock_alloc_file(sock, 0, NULL);
> + if (!sock_filp) {
sock_alloc_file() never returns NULL, only valid pointers on success or
ERR_PTRs on failue.
> + rc = -ENOMEM;
> + sock_release(sock);
> + goto out;
> + }
> +
> + rc = kernel_sock_unlocked_ioctl(sock_filp, cmd, arg);
This is an unrelated cleanup. Do it in a different patch.
> +
> + fput(sock_filp);
> +out:
> + if (fd >= 0)
> + sys_close(fd);
This is a new change as well. "fd" is always -1 so this is dead code.
> + return rc;
> +}
> +
Here is the old function:
> -static int
> -libcfs_sock_ioctl(int cmd, unsigned long arg)
> -{
> - mm_segment_t oldmm = get_fs();
> - struct socket *sock;
> - int rc;
> - struct file *sock_filp;
> -
> - rc = sock_create (PF_INET, SOCK_STREAM, 0, &sock);
> - if (rc != 0) {
> - CERROR ("Can't create socket: %d\n", rc);
> - return rc;
> - }
> -
> - sock_filp = sock_alloc_file(sock, 0, NULL);
> - if (IS_ERR(sock_filp)) {
This check was correct in the original.
> - sock_release(sock);
> - rc = PTR_ERR(sock_filp);
> - goto out;
> - }
> -
> - set_fs(KERNEL_DS);
> - if (sock_filp->f_op->unlocked_ioctl)
> - rc = sock_filp->f_op->unlocked_ioctl(sock_filp, cmd, arg);
> - set_fs(oldmm);
> -
> - fput(sock_filp);
> -out:
> - return rc;
> -}
This patch has some bug fixes as well. Those should be sent as one
patch per bugfix with a proper changelog.
regards,
dan carpenter
next prev parent reply other threads:[~2015-05-22 11:15 UTC|newest]
Thread overview: 44+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <uja.ornl@gmail.com>
2015-05-21 22:46 ` [lustre-devel] [PATCH 0/3] First set of Intel branch merger for libcfs/lnet James Simmons
2015-05-21 22:46 ` James Simmons
2015-05-21 22:46 ` [lustre-devel] [PATCH 1/3] staging:lustre: remove tcpip abstraction from libcfs James Simmons
2015-05-21 22:46 ` James Simmons
2015-05-22 11:15 ` Dan Carpenter [this message]
2015-05-22 11:15 ` Dan Carpenter
2015-05-22 15:08 ` [lustre-devel] " Simmons, James A.
2015-05-22 15:08 ` Simmons, James A.
2015-05-22 15:39 ` Dan Carpenter
2015-05-22 15:39 ` Dan Carpenter
2015-05-22 21:40 ` Greg Kroah-Hartman
2015-05-22 21:40 ` Greg Kroah-Hartman
2015-05-21 22:46 ` [lustre-devel] [PATCH 2/3] staging:lustre: remove kernel defines in userland headers James Simmons
2015-05-21 22:46 ` James Simmons
2015-05-22 13:00 ` [lustre-devel] " Dan Carpenter
2015-05-22 13:00 ` Dan Carpenter
2015-05-22 15:12 ` [lustre-devel] " Simmons, James A.
2015-05-22 15:12 ` Simmons, James A.
2015-05-22 15:24 ` Joe Perches
2015-05-22 15:24 ` Joe Perches
2015-05-21 22:46 ` [lustre-devel] [PATCH 3/3] staging:lustre: cleanup libcfs lock handling James Simmons
2015-05-21 22:46 ` James Simmons
2015-05-22 18:32 ` [lustre-devel] [PATCH 0/6] staging:lustre: remove tcpip abstraction from libcfs James Simmons
2015-05-22 18:32 ` James Simmons
2015-05-22 18:32 ` [lustre-devel] [PATCH 1/6] staging:lustre:remove useless libcfs_sock_release James Simmons
2015-05-22 18:32 ` James Simmons
2015-05-22 18:32 ` [lustre-devel] [PATCH 2/6] staging:lustre:remove useless libcfs_sock_abort_accept James Simmons
2015-05-22 18:32 ` James Simmons
2015-05-22 18:32 ` [lustre-devel] [PATCH 3/6] staging:lustre: rename tcpip handling functions to lnet_* prefix James Simmons
2015-05-22 18:32 ` James Simmons
2015-05-22 18:32 ` [lustre-devel] [PATCH 4/6] staging:lustre: use available kernel wrappers in lib-socket.c James Simmons
2015-05-22 18:32 ` James Simmons
2015-05-22 18:32 ` [lustre-devel] [PATCH 5/6] staging:lustre: style cleanups for lib-socket.c James Simmons
2015-05-22 18:32 ` James Simmons
2015-05-25 9:37 ` [lustre-devel] " Dan Carpenter
2015-05-25 9:37 ` Dan Carpenter
2015-05-27 15:01 ` [lustre-devel] " Simmons, James A.
2015-05-27 15:01 ` Simmons, James A.
2015-05-27 15:24 ` Dan Carpenter
2015-05-27 15:24 ` Dan Carpenter
2015-05-27 21:04 ` Simmons, James A.
2015-05-27 21:04 ` Simmons, James A.
2015-05-22 18:32 ` [lustre-devel] [PATCH 6/6] staging:lustre: Update license and copyright " James Simmons
2015-05-22 18:32 ` James Simmons
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=20150522111536.GA19434@mwanda \
--to=dan.carpenter@oracle.com \
--cc=lustre-devel@lists.lustre.org \
/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.