vhost: Fix `struct file' leakage in `eventfd_link'
PATCH 1/1 vhost: Fix `struct file' leakage in `eventfd_link'
Due to increased struct file's reference counter subsequent call to filp_close' does not free the struct file'. Prepend fput' call to decrease the reference counter.
--- lib/librte_vhost/eventfd_link/eventfd_link.c | 1 + 1 file changed, 1 insertion(+)
lib/librte_vhost/eventfd_link/eventfd_link.c +1 -0
@@ -117,6 +117,7 @@ eventfd_link_ioctl(struct file *f, unsigned int ioctl, unsigned long arg)* Release the existing eventfd in the source process */ spin_lock (&files->file_lock); +fput (file);filp_close (file, files); fdt =files_fdtable (files); fdt->fd[eventfd_copy.source_fd] =NULL ;
Signature · 1 line
1.9.1
Quoted 14 lines · Pavel Boldin
Due to increased
struct file's reference counter subsequent call tofilp_close' does not free thestruct file'. Prependfput' call to decrease the reference counter.--- lib/librte_vhost/eventfd_link/eventfd_link.c | 1 + 1 file changed, 1 insertion(+)lib/librte_vhost/eventfd_link/eventfd_link.c +0
-0
lib/librte_vhost/eventfd_link/eventfd_link.c eventfd_link_ioctl(struct file *f, unsigned int ioctl, unsigned long arg) · line 120
Quoted 4 lines
lib/librte_vhost/eventfd_link/eventfd_link.c +1
-0@@ -117,6 +117,7 @@ eventfd_link_ioctl(struct file *f, unsigned int ioctl, unsigned long arg)* Release the existing eventfd in the source process */ spin_lock (&files->file_lock); +fput (file);
Could we just call atomic_long_dec here?
Quoted 3 lines
lib/librte_vhost/eventfd_link/eventfd_link.c +0
-0filp_close (file, files); fdt =files_fdtable (files); fdt->fd[eventfd_copy.source_fd] =NULL ;
A message that is not in the archive (sent off-list or not yet received): C37D651A908B024F974696C65296B57B0F3F1E14-0J0gbvR4kThpB2pF5aRoyrfspsVTdybXVpNB7YpNyf8@public.gmane.org
Quoted 17 lines · Huawei
Review
Quoted 10 lines · Pavel Boldin
Due to increased
struct file's reference counter subsequent call tofilp_close' does not free thestruct file'. Prependfput' call to decrease the reference counter.--- lib/librte_vhost/eventfd_link/eventfd_link.c | 1 + 1 file changed, 1 insertion(+)(quoted diff) +0
-0
b/lib/librte_vhost/eventfd_link/eventfd_link.clib/librte_vhost/eventfd_link/eventfd_link.c eventfd_link_ioctl(struct file *f, unsigned int
Quoted 4 lines
index 7755dd6..62c45c8 100644
lib/librte_vhost/eventfd_link/eventfd_link.c +0
-0@@ -117,6 +117,7 @@ eventfd_link_ioctl(struct file *f, unsigned intioctl, unsigned long arg)
Quoted 6 lines
lib/librte_vhost/eventfd_link/eventfd_link.c eventfd_link_ioctl(struct file *f, unsigned int ioctl, unsigned long arg) · line 120
Quoted 4 lines
lib/librte_vhost/eventfd_link/eventfd_link.c +1
-0* Release the existing eventfd in the source process */ spin_lock (&files->file_lock); +fput (file);Could we just call
atomic_long_dechere?
We can but I don't like breaking encapsulation (which is broken anyway by the code). So, there is a special method and we should use it in my opinion.
Pavel
Quoted 5 lines
filp_close(file, files);Quoted 2 lines
lib/librte_vhost/eventfd_link/eventfd_link.c +0
-0fdt =files_fdtable (files); fdt->fd[eventfd_copy.source_fd] =NULL ;
On 3/23/2015 10:37 PM, Pavel Boldin wrote:
On Mon, Mar 23, 2015 at 4:21 PM, Xie, Huawei <[email protected]<mailto:[email protected]>> wrote:
Quoted 14 lines · Pavel Boldin
Due to increased
struct file's reference counter subsequent call tofilp_close' does not free thestruct file'. Prependfput' call to decrease the reference counter.--- lib/librte_vhost/eventfd_link/eventfd_link.c | 1 + 1 file changed, 1 insertion(+)lib/librte_vhost/eventfd_link/eventfd_link.c +0
-0
lib/librte_vhost/eventfd_link/eventfd_link.c eventfd_link_ioctl(struct file *f, unsigned int ioctl, unsigned long arg) · line 120
Quoted 4 lines
lib/librte_vhost/eventfd_link/eventfd_link.c +1
-0@@ -117,6 +117,7 @@ eventfd_link_ioctl(struct file *f, unsigned int ioctl, unsigned long arg)* Release the existing eventfd in the source process */ spin_lock (&files->file_lock); +fput (file);
Could we just call atomic_long_dec here?
We can but I don't like breaking encapsulation (which is broken anyway by the code). So, there is a special method and we should use it in my opinion. it is increased by atomic_long_inc_not_zero so why don't we use the symmetric function?
Pavel
Quoted 3 lines
lib/librte_vhost/eventfd_link/eventfd_link.c +0
-0filp_close (file, files); fdt =files_fdtable (files); fdt->fd[eventfd_copy.source_fd] =NULL ;
A message that is not in the archive (sent off-list or not yet received): C37D651A908B024F974696C65296B57B0F3F1F75-0J0gbvR4kThpB2pF5aRoyrfspsVTdybXVpNB7YpNyf8@public.gmane.org
Quoted 27 lines · Huawei
On 3/23/2015 10:37 PM, Pavel Boldin wrote:
On Mon, Mar 23, 2015 at 4:21 PM, Xie, Huawei <[email protected]<mailto:
[email protected]>> wrote:Quoted 5 lines · Pavel Boldin
Due to increased
struct file's reference counter subsequent call tofilp_close' does not free thestruct file'. Prependfput' call to decrease the reference counter.pboldin-nYU0QVwCCFFWk0Htik3J/[email protected]>>
Review
Quoted 5 lines
--- lib/librte_vhost/eventfd_link/eventfd_link.c | 1 + 1 file changed, 1 insertion(+)(quoted diff) +0
-0
b/lib/librte_vhost/eventfd_link/eventfd_link.clib/librte_vhost/eventfd_link/eventfd_link.c eventfd_link_ioctl(struct file *f, unsigned int
Quoted 4 lines
index 7755dd6..62c45c8 100644
lib/librte_vhost/eventfd_link/eventfd_link.c +0
-0@@ -117,6 +117,7 @@ eventfd_link_ioctl(struct file *f, unsigned intioctl, unsigned long arg)
lib/librte_vhost/eventfd_link/eventfd_link.c eventfd_link_ioctl(struct file *f, unsigned int ioctl, unsigned long arg) · line 120
Quoted 4 lines
lib/librte_vhost/eventfd_link/eventfd_link.c +1
-0* Release the existing eventfd in the source process */ spin_lock (&files->file_lock); +fput (file);
Quoted 7 lines
Could we just call
atomic_long_dechere?We can but I don't like breaking encapsulation (which is broken anyway by the code). So, there is a special method and we should use it in my opinion. it is increased by
atomic_long_inc_not_zeroso why don't we use the symmetric function?
The code with atomic_long_inc_not_zero' call is a copy-paste of the fget' function. If we want to make it clear we should make a separate function and name it so: `fget_from_files'.
Second thing is: another thread of the same processor can call the sys_close' on the fd' and this will dereference counter so fput' will correctly free the struct file'. Using atomic_long_dec' will leak a struct file' and print a KERN_ERR message by `filp_close'.
So, the common thing is to use appropriate functions and don't reinvent the wheel.
Pavel
Quoted 11 lines
Pavel
Quoted 3 lines
lib/librte_vhost/eventfd_link/eventfd_link.c +0
-0filp_close (file, files); fdt =files_fdtable (files); fdt->fd[eventfd_copy.source_fd] =NULL ;
On 3/23/2015 10:52 PM, Pavel Boldin wrote:
On Mon, Mar 23, 2015 at 4:41 PM, Xie, Huawei <[email protected]<mailto:[email protected]>> wrote:
On 3/23/2015 10:37 PM, Pavel Boldin wrote:
On Mon, Mar 23, 2015 at 4:21 PM, Xie, Huawei <[email protected]<mailto:[email protected]><mailto:[email protected]<mailto:[email protected]>>> wrote:
Quoted 14 lines · Pavel Boldin
Due to increased
struct file's reference counter subsequent call tofilp_close' does not free thestruct file'. Prependfput' call to decrease the reference counter.--- lib/librte_vhost/eventfd_link/eventfd_link.c | 1 + 1 file changed, 1 insertion(+)lib/librte_vhost/eventfd_link/eventfd_link.c +0
-0
lib/librte_vhost/eventfd_link/eventfd_link.c eventfd_link_ioctl(struct file *f, unsigned int ioctl, unsigned long arg) · line 120
Quoted 4 lines
lib/librte_vhost/eventfd_link/eventfd_link.c +1
-0@@ -117,6 +117,7 @@ eventfd_link_ioctl(struct file *f, unsigned int ioctl, unsigned long arg)* Release the existing eventfd in the source process */ spin_lock (&files->file_lock); +fput (file);
Could we just call atomic_long_dec here?
We can but I don't like breaking encapsulation (which is broken anyway by the code). So, there is a special method and we should use it in my opinion.
it is increased by atomic_long_inc_not_zero so why don't we use the symmetric function?
The code with atomic_long_inc_not_zero' call is a copy-paste of the fget' function. If we want to make it clear we should make a separate function and name it so: `fget_from_files'.
I don't understand why there is a (exact?) copy&paste of fget there. :).
Maybe you could post a patchset, first replace the copy/paste with fget and then this patch. It will looks much clearer.
Second thing is: another thread of the same processor can call the sys_close' on the fd' and this will dereference counter so fput' will correctly free the struct file'. Using atomic_long_dec' will leak a struct file' and print a KERN_ERR message by `filp_close'.
So, the common thing is to use appropriate functions and don't reinvent the wheel.
Pavel
Pavel
Quoted 3 lines
lib/librte_vhost/eventfd_link/eventfd_link.c +0
-0filp_close (file, files); fdt =files_fdtable (files); fdt->fd[eventfd_copy.source_fd] =NULL ;
A message that is not in the archive (sent off-list or not yet received): C37D651A908B024F974696C65296B57B0F3F240D-0J0gbvR4kThpB2pF5aRoyrfspsVTdybXVpNB7YpNyf8@public.gmane.org
Huawei,
This thread is unreadable because your mailer is not quoting. Please check. Thanks
2015-03-23 15:16, Xie, Huawei:
Quoted 49 lines · Pavel Boldin
On Mon, Mar 23, 2015 at 4:41 PM, Xie, Huawei <[email protected]<mailto:[email protected]>> wrote:
On 3/23/2015 10:37 PM, Pavel Boldin wrote:On Mon, Mar 23, 2015 at 4:21 PM, Xie, Huawei <[email protected]<mailto:[email protected]><mailto:[email protected]<mailto:[email protected]>>> wrote:
Quoted 14 lines · Pavel Boldin
Due to increased
struct file's reference counter subsequent call tofilp_close' does not free thestruct file'. Prependfput' call to decrease the reference counter.--- lib/librte_vhost/eventfd_link/eventfd_link.c | 1 + 1 file changed, 1 insertion(+)lib/librte_vhost/eventfd_link/eventfd_link.c +0
-0lib/librte_vhost/eventfd_link/eventfd_link.c eventfd_link_ioctl(struct file *f, unsigned int ioctl, unsigned long arg) · line 120
Quoted 4 lines
lib/librte_vhost/eventfd_link/eventfd_link.c +1
-0@@ -117,6 +117,7 @@ eventfd_link_ioctl(struct file *f, unsigned int ioctl, unsigned long arg)* Release the existing eventfd in the source process */ spin_lock (&files->file_lock); +fput (file);Could we just call
atomic_long_dechere?We can but I don't like breaking encapsulation (which is broken anyway by the code). So, there is a special method and we should use it in my opinion.
it is increased byatomic_long_inc_not_zeroso why don't we use the symmetric function?
The code withatomic_long_inc_not_zero' call is a copy-paste of thefget' function. If we want to make it clear we should make a separate function and name it so: `fget_from_files'.I don't understand why there is a (exact?) copy&paste of fget there. :).
Maybe you could post a patchset, first replace the copy/paste with fget and then this patch. It will looks much clearer.
Second thing is: another thread of the same processor can call thesys_close' on thefd' and this will dereference counter sofput' will correctly free thestruct file'. Usingatomic_long_dec' will leak astruct file' and print aKERN_ERRmessage by `filp_close'.So, the common thing is to use appropriate functions and don't reinvent the wheel.
Pavel
Pavel
Quoted 3 lines
lib/librte_vhost/eventfd_link/eventfd_link.c +0
-0filp_close (file, files); fdt =files_fdtable (files); fdt->fd[eventfd_copy.source_fd] =NULL ;
Quoted 44 lines · Huawei
On 3/23/2015 10:52 PM, Pavel Boldin wrote:
On Mon, Mar 23, 2015 at 4:41 PM, Xie, Huawei <[email protected]<mailto:
[email protected]>> wrote:
On 3/23/2015 10:37 PM, Pavel Boldin wrote:On Mon, Mar 23, 2015 at 4:21 PM, Xie, Huawei <[email protected]<mailto:
[email protected]><mailto:[email protected]<mailto:
[email protected]>>> wrote:Quoted 5 lines · Pavel Boldin
Due to increased
struct file's reference counter subsequent call tofilp_close' does not free thestruct file'. Prependfput' call to decrease the reference counter.pboldin-nYU0QVwCCFFWk0Htik3J/[email protected]><mailto:pboldin-nYU0QVwCCFFWk0Htik3J/[email protected]<mailto:
pboldin-nYU0QVwCCFFWk0Htik3J/[email protected]>>>Review
Quoted 5 lines
--- lib/librte_vhost/eventfd_link/eventfd_link.c | 1 + 1 file changed, 1 insertion(+)(quoted diff) +0
-0
b/lib/librte_vhost/eventfd_link/eventfd_link.clib/librte_vhost/eventfd_link/eventfd_link.c eventfd_link_ioctl(struct file *f, unsigned int
Quoted 4 lines
index 7755dd6..62c45c8 100644
lib/librte_vhost/eventfd_link/eventfd_link.c +0
-0@@ -117,6 +117,7 @@ eventfd_link_ioctl(struct file *f, unsigned intioctl, unsigned long arg)
lib/librte_vhost/eventfd_link/eventfd_link.c eventfd_link_ioctl(struct file *f, unsigned int · line 120
Quoted 4 lines
lib/librte_vhost/eventfd_link/eventfd_link.c +1
-0* Release the existing eventfd in the source process */ spin_lock (&files->file_lock); +fput (file);Could we just call
atomic_long_dechere?We can but I don't like breaking encapsulation (which is broken anyway by the code). So, there is a special method and we should use it in my opinion. it is increased by
atomic_long_inc_not_zeroso why don't we use the symmetric function?
The code withatomic_long_inc_not_zero' call is a copy-paste of thefget' function. If we want to make it clear we should make a separate function and name it so: `fget_from_files'.
Quoted 4 lines
I don't understand why there is a (exact?) copy&paste of fget there. :). Maybe you could post a patchset, first replace the copy/paste with fget and then this patch. It will looks much clearer.
The code of this module received little to none review and requires some love at the moment.
I wanted to refactor the module completely but Thomas said it is not going to go into the 2.0. So I decided to make a simple one-line fix.
If you are interested this [0] is the latest version of the refactoring patch.
I can provide you with an application that checks that there is indeed no leakage and ensures that the `eventfd' moving works. It is being used in our builds as a test [1]. The code is "heredoc"ed in [2]
[0] http://dpdk.org/dev/patchwork/patch/4113/
[1] https://review.fuel-infra.org/#/c/4639/
[2] https://review.fuel-infra.org/#/c/4639/3/tests/runtests.sh
Pavel
Quoted 23 lines
Second thing is: another thread of the same processor can call the
sys_close' on thefd' and this will dereference counter sofput' will correctly free thestruct file'. Usingatomic_long_dec' will leak astruct file' and print aKERN_ERRmessage by `filp_close'.So, the common thing is to use appropriate functions and don't reinvent the wheel.
Pavel
Pavel
Quoted 3 lines
lib/librte_vhost/eventfd_link/eventfd_link.c +0
-0filp_close (file, files); fdt =files_fdtable (files); fdt->fd[eventfd_copy.source_fd] =NULL ;
On 3/23/2015 11:27 PM, Pavel Boldin wrote:
On Mon, Mar 23, 2015 at 5:16 PM, Xie, Huawei <[email protected]<mailto:[email protected]>> wrote:
On 3/23/2015 10:52 PM, Pavel Boldin wrote:
On Mon, Mar 23, 2015 at 4:41 PM, Xie, Huawei <[email protected]<mailto:[email protected]><mailto:[email protected]<mailto:[email protected]>>> wrote:
On 3/23/2015 10:37 PM, Pavel Boldin wrote:
On Mon, Mar 23, 2015 at 4:21 PM, Xie, Huawei <[email protected]<mailto:[email protected]><mailto:[email protected]<mailto:[email protected]>><mailto:[email protected]<mailto:[email protected]><mailto:[email protected]<mailto:[email protected]>>>> wrote:
Quoted 14 lines · Pavel Boldin
Due to increased
struct file's reference counter subsequent call tofilp_close' does not free thestruct file'. Prependfput' call to decrease the reference counter.--- lib/librte_vhost/eventfd_link/eventfd_link.c | 1 + 1 file changed, 1 insertion(+)lib/librte_vhost/eventfd_link/eventfd_link.c +0
-0
lib/librte_vhost/eventfd_link/eventfd_link.c eventfd_link_ioctl(struct file *f, unsigned int ioctl, unsigned long arg) · line 120
Quoted 4 lines
lib/librte_vhost/eventfd_link/eventfd_link.c +1
-0@@ -117,6 +117,7 @@ eventfd_link_ioctl(struct file *f, unsigned int ioctl, unsigned long arg)* Release the existing eventfd in the source process */ spin_lock (&files->file_lock); +fput (file);
Could we just call atomic_long_dec here?
We can but I don't like breaking encapsulation (which is broken anyway by the code). So, there is a special method and we should use it in my opinion.
it is increased by atomic_long_inc_not_zero so why don't we use the symmetric function?
The code with atomic_long_inc_not_zero' call is a copy-paste of the fget' function. If we want to make it clear we should make a separate function and name it so: `fget_from_files'.
I don't understand why there is a (exact?) copy&paste of fget there. :).
Maybe you could post a patchset, first replace the copy/paste with fget and then this patch. It will looks much clearer. The code of this module received little to none review and requires some love at the moment.
I wanted to refactor the module completely but Thomas said it is not going to go into the 2.0. So I decided to make a simple one-line fix. Another isse is do we really need a src fd here? Could we just allocate a unsed fd in the kernel and installed it with the target eventfd.
If you are interested this [0] is the latest version of the refactoring patch.
I can provide you with an application that checks that there is indeed no leakage and ensures that the `eventfd' moving works. It is being used in our builds as a test [1]. The code is "heredoc"ed in [2]
[0] http://dpdk.org/dev/patchwork/patch/4113/
[1] https://review.fuel-infra.org/#/c/4639/
[2] https://review.fuel-infra.org/#/c/4639/3/tests/runtests.sh
Pavel
Second thing is: another thread of the same processor can call the sys_close' on the fd' and this will dereference counter so fput' will correctly free the struct file'. Using atomic_long_dec' will leak a struct file' and print a KERN_ERR message by `filp_close'.
So, the common thing is to use appropriate functions and don't reinvent the wheel.
Pavel
Pavel
Quoted 3 lines
lib/librte_vhost/eventfd_link/eventfd_link.c +0
-0filp_close (file, files); fdt =files_fdtable (files); fdt->fd[eventfd_copy.source_fd] =NULL ;
A message that is not in the archive (sent off-list or not yet received): C37D651A908B024F974696C65296B57B0F3F2694-0J0gbvR4kThpB2pF5aRoyrfspsVTdybXVpNB7YpNyf8@public.gmane.org
Quoted 60 lines · Huawei
On 3/23/2015 11:27 PM, Pavel Boldin wrote:
On Mon, Mar 23, 2015 at 5:16 PM, Xie, Huawei <[email protected]<mailto:
[email protected]>> wrote:
On 3/23/2015 10:52 PM, Pavel Boldin wrote:On Mon, Mar 23, 2015 at 4:41 PM, Xie, Huawei <[email protected]<mailto:
[email protected]><mailto:[email protected]<mailto:
[email protected]>>> wrote:
On 3/23/2015 10:37 PM, Pavel Boldin wrote:On Mon, Mar 23, 2015 at 4:21 PM, Xie, Huawei <[email protected]<mailto:
[email protected]><mailto:[email protected]<mailto:
[email protected]>><mailto:[email protected]<mailto:
[email protected]><mailto:[email protected]<mailto:
[email protected]>>>> wrote:Quoted 5 lines · Pavel Boldin
Due to increased
struct file's reference counter subsequent call tofilp_close' does not free thestruct file'. Prependfput' call to decrease the reference counter.pboldin-nYU0QVwCCFFWk0Htik3J/[email protected]><mailto:pboldin-nYU0QVwCCFFWk0Htik3J/[email protected]<mailto:
pboldin-nYU0QVwCCFFWk0Htik3J/[email protected]>><mailto:pboldin-nYU0QVwCCFFWk0Htik3J/[email protected]<mailto:
pboldin-nYU0QVwCCFFWk0Htik3J/[email protected]><mailto:pboldin-nYU0QVwCCFFWk0Htik3J/[email protected]<mailto:
pboldin-nYU0QVwCCFFWk0Htik3J/[email protected]>>>>Review
Quoted 5 lines
--- lib/librte_vhost/eventfd_link/eventfd_link.c | 1 + 1 file changed, 1 insertion(+)(quoted diff) +0
-0
b/lib/librte_vhost/eventfd_link/eventfd_link.clib/librte_vhost/eventfd_link/eventfd_link.c eventfd_link_ioctl(struct file *f, unsigned int
Quoted 4 lines
index 7755dd6..62c45c8 100644
lib/librte_vhost/eventfd_link/eventfd_link.c +0
-0@@ -117,6 +117,7 @@ eventfd_link_ioctl(struct file *f, unsigned intioctl, unsigned long arg)
lib/librte_vhost/eventfd_link/eventfd_link.c eventfd_link_ioctl(struct file *f, unsigned int · line 120
Quoted 4 lines
lib/librte_vhost/eventfd_link/eventfd_link.c +1
-0* Release the existing eventfd in the source process */ spin_lock (&files->file_lock); +fput (file);Could we just call
atomic_long_dechere?We can but I don't like breaking encapsulation (which is broken anyway by the code). So, there is a special method and we should use it in my opinion. it is increased by
atomic_long_inc_not_zeroso why don't we use the symmetric function?
The code withatomic_long_inc_not_zero' call is a copy-paste of thefget' function. If we want to make it clear we should make a separate function and name it so: `fget_from_files'.I don't understand why there is a (exact?) copy&paste of fget there. :). Maybe you could post a patchset, first replace the copy/paste with fget and then this patch. It will looks much clearer.
The code of this module received little to none review and requires some love at the moment.
Quoted 5 lines
I wanted to refactor the module completely but Thomas said it is not going to go into the 2.0. So I decided to make a simple one-line fix. Another isse is do we really need a src fd here? Could we just allocate a unsed fd in the kernel and installed it with the target eventfd.
This is for DPDK team to decide and should be discussed separately.
Pavel
Quoted 39 lines
If you are interested this [0] is the latest version of the refactoring patch.
I can provide you with an application that checks that there is indeed no leakage and ensures that the `eventfd' moving works. It is being used in our builds as a test [1]. The code is "heredoc"ed in [2]
[0] http://dpdk.org/dev/patchwork/patch/4113/
[1] https://review.fuel-infra.org/#/c/4639/
[2] https://review.fuel-infra.org/#/c/4639/3/tests/runtests.shPavel
Second thing is: another thread of the same processor can call the
sys_close' on thefd' and this will dereference counter sofput' will correctly free thestruct file'. Usingatomic_long_dec' will leak astruct file' and print aKERN_ERRmessage by `filp_close'.So, the common thing is to use appropriate functions and don't reinvent the wheel.
Pavel
Pavel
Quoted 3 lines
lib/librte_vhost/eventfd_link/eventfd_link.c +0
-0filp_close (file, files); fdt =files_fdtable (files); fdt->fd[eventfd_copy.source_fd] =NULL ;
Quoted 14 lines · Pavel Boldin
Due to increased
struct file's reference counter subsequent call tofilp_close' does not free thestruct file'. Prependfput' call to decrease the reference counter.--- lib/librte_vhost/eventfd_link/eventfd_link.c | 1 + 1 file changed, 1 insertion(+)lib/librte_vhost/eventfd_link/eventfd_link.c +0
-0
lib/librte_vhost/eventfd_link/eventfd_link.c eventfd_link_ioctl(struct file *f, unsigned int ioctl, unsigned long arg) · line 123
Quoted 7 lines
lib/librte_vhost/eventfd_link/eventfd_link.c +1
-0@@ -117,6 +117,7 @@ eventfd_link_ioctl(struct file *f, unsigned int ioctl, unsigned long arg)* Release the existing eventfd in the source process */ spin_lock (&files->file_lock); +fput (file);filp_close (file, files); fdt =files_fdtable (files); fdt->fd[eventfd_copy.source_fd] =NULL ;
Acked-by Huawei Xie <[email protected]>
In future, we should remove the allocation of src eventfd, allocate a free fd from kernel, and install it with target fd.
A message that is not in the archive (sent off-list or not yet received): C37D651A908B024F974696C65296B57B0F3F46FB-0J0gbvR4kThpB2pF5aRoyrfspsVTdybXVpNB7YpNyf8@public.gmane.org
Quoted 24 lines · Huawei
Review
Quoted 10 lines · Pavel Boldin
Due to increased
struct file's reference counter subsequent call tofilp_close' does not free thestruct file'. Prependfput' call to decrease the reference counter.--- lib/librte_vhost/eventfd_link/eventfd_link.c | 1 + 1 file changed, 1 insertion(+)(quoted diff) +0
-0
b/lib/librte_vhost/eventfd_link/eventfd_link.clib/librte_vhost/eventfd_link/eventfd_link.c eventfd_link_ioctl(struct file *f, unsigned int
Quoted 4 lines
index 7755dd6..62c45c8 100644
lib/librte_vhost/eventfd_link/eventfd_link.c +0
-0@@ -117,6 +117,7 @@ eventfd_link_ioctl(struct file *f, unsigned intioctl, unsigned long arg)
lib/librte_vhost/eventfd_link/eventfd_link.c eventfd_link_ioctl(struct file *f, unsigned int ioctl, unsigned long arg) · line 123
Quoted 7 lines
lib/librte_vhost/eventfd_link/eventfd_link.c +1
-0* Release the existing eventfd in the source process */ spin_lock (&files->file_lock); +fput (file);filp_close (file, files); fdt =files_fdtable (files); fdt->fd[eventfd_copy.source_fd] =NULL ;
Quoted 5 lines
Acked-by Huawei Xie <[email protected]>
In future, we should remove the allocation of src eventfd, allocate a free fd from kernel, and install it with target fd.
Well, I don't think this is correct, because this will put too much job for the kernel module making it a combiner.
At the moment I propose to accept module refactoring patch to the upstream.
After that the module can be reworked along with the application code. The reason is I can't work on DPDK since I have no hardware to test application at so I can't help with patch that touches application code.
Pavel
On 3/24/2015 7:10 PM, Pavel Boldin wrote:
On Tue, Mar 24, 2015 at 8:28 AM, Xie, Huawei <[email protected]<mailto:[email protected]>> wrote:
Quoted 14 lines · Pavel Boldin
Due to increased
struct file's reference counter subsequent call tofilp_close' does not free thestruct file'. Prependfput' call to decrease the reference counter.--- lib/librte_vhost/eventfd_link/eventfd_link.c | 1 + 1 file changed, 1 insertion(+)lib/librte_vhost/eventfd_link/eventfd_link.c +0
-0
lib/librte_vhost/eventfd_link/eventfd_link.c eventfd_link_ioctl(struct file *f, unsigned int ioctl, unsigned long arg) · line 123
Quoted 7 lines
lib/librte_vhost/eventfd_link/eventfd_link.c +1
-0@@ -117,6 +117,7 @@ eventfd_link_ioctl(struct file *f, unsigned int ioctl, unsigned long arg)* Release the existing eventfd in the source process */ spin_lock (&files->file_lock); +fput (file);filp_close (file, files); fdt =files_fdtable (files); fdt->fd[eventfd_copy.source_fd] =NULL ;
Acked-by Huawei Xie <[email protected]<mailto:[email protected]>>
In future, we should remove the allocation of src eventfd, allocate a free fd from kernel, and install it with target fd.
Well, I don't think this is correct, because this will put too much job for the kernel module making it a combiner.
At the moment I propose to accept module refactoring patch to the upstream.
After that the module can be reworked along with the application code. The reason is I can't work on DPDK since I have no hardware to test application at so I can't help with patch that touches application code.
Pavel
Pavel:
I am not asking to do it right now but in future, and i agree we accept the refactoring patch now, so i ack the patch. Huawei
A message that is not in the archive (sent off-list or not yet received): C37D651A908B024F974696C65296B57B0F3F59D7-0J0gbvR4kThpB2pF5aRoyrfspsVTdybXVpNB7YpNyf8@public.gmane.org
Quoted 40 lines · Huawei
On 3/24/2015 7:10 PM, Pavel Boldin wrote:
On Tue, Mar 24, 2015 at 8:28 AM, Xie, Huawei <[email protected]<mailto:
[email protected]>> wrote:Quoted 5 lines · Pavel Boldin
Due to increased
struct file's reference counter subsequent call tofilp_close' does not free thestruct file'. Prependfput' call to decrease the reference counter.pboldin-nYU0QVwCCFFWk0Htik3J/[email protected]>>
Review
Quoted 5 lines
--- lib/librte_vhost/eventfd_link/eventfd_link.c | 1 + 1 file changed, 1 insertion(+)(quoted diff) +0
-0
b/lib/librte_vhost/eventfd_link/eventfd_link.clib/librte_vhost/eventfd_link/eventfd_link.c eventfd_link_ioctl(struct file *f, unsigned int
Quoted 4 lines
index 7755dd6..62c45c8 100644
lib/librte_vhost/eventfd_link/eventfd_link.c +0
-0@@ -117,6 +117,7 @@ eventfd_link_ioctl(struct file *f, unsigned intioctl, unsigned long arg)
lib/librte_vhost/eventfd_link/eventfd_link.c eventfd_link_ioctl(struct file *f, unsigned int ioctl, unsigned long arg) · line 123
Quoted 7 lines
lib/librte_vhost/eventfd_link/eventfd_link.c +1
-0* Release the existing eventfd in the source process */ spin_lock (&files->file_lock); +fput (file);filp_close (file, files); fdt =files_fdtable (files); fdt->fd[eventfd_copy.source_fd] =NULL ;Acked-by Huawei Xie <[email protected]<mailto:[email protected]>>
In future, we should remove the allocation of src eventfd, allocate a free fd from kernel, and install it with target fd.
Well, I don't think this is correct, because this will put too much job for the kernel module making it a combiner.
At the moment I propose to accept module refactoring patch to the upstream.
Quoted 9 lines
After that the module can be reworked along with the application code. The reason is I can't work on DPDK since I have no hardware to test application at so I can't help with patch that touches application code.
Pavel
Pavel:
I am not asking to do it right now but in future, and i agree we accept the refactoring patch now, so i ack the patch.
Huawei, this is the refactoring patch [1]. This patch is merely a bugfix.
[1] http://dpdk.org/dev/patchwork/patch/4113/
Quoted 2 lines
Huawei
On 3/25/2015 4:08 AM, Pavel Boldin wrote:
On Tue, Mar 24, 2015 at 6:20 PM, Xie, Huawei <[email protected]<mailto:[email protected]>> wrote:
On 3/24/2015 7:10 PM, Pavel Boldin wrote:
On Tue, Mar 24, 2015 at 8:28 AM, Xie, Huawei <[email protected]<mailto:[email protected]><mailto:[email protected]<mailto:[email protected]>>> wrote:
Quoted 14 lines · Pavel Boldin
Due to increased
struct file's reference counter subsequent call tofilp_close' does not free thestruct file'. Prependfput' call to decrease the reference counter.--- lib/librte_vhost/eventfd_link/eventfd_link.c | 1 + 1 file changed, 1 insertion(+)lib/librte_vhost/eventfd_link/eventfd_link.c +0
-0
lib/librte_vhost/eventfd_link/eventfd_link.c eventfd_link_ioctl(struct file *f, unsigned int ioctl, unsigned long arg) · line 123
Quoted 7 lines
lib/librte_vhost/eventfd_link/eventfd_link.c +1
-0@@ -117,6 +117,7 @@ eventfd_link_ioctl(struct file *f, unsigned int ioctl, unsigned long arg)* Release the existing eventfd in the source process */ spin_lock (&files->file_lock); +fput (file);filp_close (file, files); fdt =files_fdtable (files); fdt->fd[eventfd_copy.source_fd] =NULL ;
Acked-by Huawei Xie <[email protected]<mailto:[email protected]><mailto:[email protected]<mailto:[email protected]>>>
In future, we should remove the allocation of src eventfd, allocate a free fd from kernel, and install it with target fd.
Well, I don't think this is correct, because this will put too much job for the kernel module making it a combiner.
At the moment I propose to accept module refactoring patch to the upstream.
After that the module can be reworked along with the application code. The reason is I can't work on DPDK since I have no hardware to test application at so I can't help with patch that touches application code.
Pavel
Pavel:
I am not asking to do it right now but in future, and i agree we accept the refactoring patch now, so i ack the patch. Huawei, this is the refactoring patch [1]. This patch is merely a bugfix.
[1] http://dpdk.org/dev/patchwork/patch/4113/
Huawei
Thanks for your patch and fd checking tool. I will re-ack the patch as i see quoting issue in my previous ack.
Thomas Monjalon
AppliedQuoted 6 lines
Quoted 5 lines
Due to increased
struct file's reference counter subsequent call tofilp_close' does not free thestruct file'. Prependfput' call to decrease the reference counter.Acked-by Huawei Xie <[email protected]>
Applied, thanks
(already sent this notification but this ack was did many times in detached threads)
Quoted 14 lines · Pavel Boldin
Due to increased
struct file's reference counter subsequent call tofilp_close' does not free thestruct file'. Prependfput' call to decrease the reference counter.--- lib/librte_vhost/eventfd_link/eventfd_link.c | 1 + 1 file changed, 1 insertion(+)lib/librte_vhost/eventfd_link/eventfd_link.c +0
-0
lib/librte_vhost/eventfd_link/eventfd_link.c eventfd_link_ioctl(struct file *f, unsigned int ioctl, unsigned long arg) · line 123
Quoted 7 lines
lib/librte_vhost/eventfd_link/eventfd_link.c +1
-0@@ -117,6 +117,7 @@ eventfd_link_ioctl(struct file *f, unsigned int ioctl, unsigned long arg)* Release the existing eventfd in the source process */ spin_lock (&files->file_lock); +fput (file);filp_close (file, files); fdt =files_fdtable (files); fdt->fd[eventfd_copy.source_fd] =NULL ;
Acked-by Huawei Xie <[email protected]>
A message that is not in the archive (sent off-list or not yet received): C37D651A908B024F974696C65296B57B0F3FB942-0J0gbvR4kThpB2pF5aRoyrfspsVTdybXVpNB7YpNyf8@public.gmane.org
Quoted 25 lines · Huawei
Review
Quoted 10 lines · Pavel Boldin
Due to increased
struct file's reference counter subsequent call tofilp_close' does not free thestruct file'. Prependfput' call to decrease the reference counter.--- lib/librte_vhost/eventfd_link/eventfd_link.c | 1 + 1 file changed, 1 insertion(+)(quoted diff) +0
-0
b/lib/librte_vhost/eventfd_link/eventfd_link.clib/librte_vhost/eventfd_link/eventfd_link.c eventfd_link_ioctl(struct file *f, unsigned int
Quoted 4 lines
index 7755dd6..62c45c8 100644
lib/librte_vhost/eventfd_link/eventfd_link.c +0
-0@@ -117,6 +117,7 @@ eventfd_link_ioctl(struct file *f, unsigned intioctl, unsigned long arg)
lib/librte_vhost/eventfd_link/eventfd_link.c eventfd_link_ioctl(struct file *f, unsigned int ioctl, unsigned long arg) · line 123
Quoted 7 lines
lib/librte_vhost/eventfd_link/eventfd_link.c +1
-0* Release the existing eventfd in the source process */ spin_lock (&files->file_lock); +fput (file);filp_close (file, files); fdt =files_fdtable (files); fdt->fd[eventfd_copy.source_fd] =NULL ;
Quoted 2 lines
Acked-by Huawei Xie <[email protected]>
The patch is still in "New" stat in patchwork. I think you forgot a ":" between Acked-by and email.
Pavel
Thomas Monjalon
AppliedQuoted 7 lines
Quoted 5 lines
Due to increased
struct file's reference counter subsequent call tofilp_close' does not free thestruct file'. Prependfput' call to decrease the reference counter.Acked-by Huawei Xie <[email protected]>
Applied, thanks
Quoted 10 lines · Thomas Monjalon
Quoted 7 lines
Quoted 5 lines
Due to increased
struct file's reference counter subsequent call tofilp_close' does not free thestruct file'. Prependfput' call to decrease the reference counter.Acked-by Huawei Xie <[email protected]>
Applied, thanks
What should I do with the refactoring patch in your opinion?
Should I split it in parts to ease review?
Pavel
A message that is not in the archive (sent off-list or not yet received): CACf4_B9ims0bL3fqk5Pm6sTHkm7pdHcTgFNXLvKYZf5Gip9LDg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 5 lines
Due to increased
struct file's reference counter subsequent call tofilp_close' does not free thestruct file'. Prependfput' call to decrease the reference counter.
Quoted 7 lines
Quoted 3 lines
Quoted 1 line
Acked-by Huawei Xie <[email protected]>
Applied, thanks
What should I do with the refactoring patch in your opinion?
Should I split it in parts to ease review?
I didn't review it so I have no good advice.
But in general, it's better to split patches in logic units if it makes sense. Note that we are closing 2.0. Refactoring patches are deffered to 2.1.
Quoted 14 lines · Pavel Boldin
Due to increased
struct file's reference counter subsequent call tofilp_close' does not free thestruct file'. Prependfput' call to decrease the reference counter.--- lib/librte_vhost/eventfd_link/eventfd_link.c | 1 + 1 file changed, 1 insertion(+)lib/librte_vhost/eventfd_link/eventfd_link.c +0
-0
lib/librte_vhost/eventfd_link/eventfd_link.c eventfd_link_ioctl(struct file *f, unsigned int ioctl, unsigned long arg) · line 123
Quoted 7 lines
lib/librte_vhost/eventfd_link/eventfd_link.c +1
-0@@ -117,6 +117,7 @@ eventfd_link_ioctl(struct file *f, unsigned int ioctl, unsigned long arg)* Release the existing eventfd in the source process */ spin_lock (&files->file_lock); +fput (file);filp_close (file, files); fdt =files_fdtable (files); fdt->fd[eventfd_copy.source_fd] =NULL ;