All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ceph: avoid accessing freeing inode in ceph_check_delayed_caps()
@ 2017-06-27 13:43 Yan, Zheng
  2017-06-27 14:23 ` Jeff Layton
  0 siblings, 1 reply; 2+ messages in thread
From: Yan, Zheng @ 2017-06-27 13:43 UTC (permalink / raw)
  To: ceph-devel; +Cc: jlayton, Yan, Zheng

Signed-off-by: "Yan, Zheng" <zyan@redhat.com>
---
 fs/ceph/caps.c | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/fs/ceph/caps.c b/fs/ceph/caps.c
index f555245..7007ae2 100644
--- a/fs/ceph/caps.c
+++ b/fs/ceph/caps.c
@@ -3809,6 +3809,7 @@ void ceph_handle_caps(struct ceph_mds_session *session,
  */
 void ceph_check_delayed_caps(struct ceph_mds_client *mdsc)
 {
+	struct inode *inode;
 	struct ceph_inode_info *ci;
 	int flags = CHECK_CAPS_NODELAY;
 
@@ -3824,9 +3825,15 @@ void ceph_check_delayed_caps(struct ceph_mds_client *mdsc)
 		    time_before(jiffies, ci->i_hold_caps_max))
 			break;
 		list_del_init(&ci->i_cap_delay_list);
+
+		inode = igrab(&ci->vfs_inode);
 		spin_unlock(&mdsc->cap_delay_lock);
-		dout("check_delayed_caps on %p\n", &ci->vfs_inode);
-		ceph_check_caps(ci, flags, NULL);
+
+		if (inode) {
+			dout("check_delayed_caps on %p\n", inode);
+			ceph_check_caps(ci, flags, NULL);
+			iput(inode);
+		}
 	}
 	spin_unlock(&mdsc->cap_delay_lock);
 }
-- 
2.9.4


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] ceph: avoid accessing freeing inode in ceph_check_delayed_caps()
  2017-06-27 13:43 [PATCH] ceph: avoid accessing freeing inode in ceph_check_delayed_caps() Yan, Zheng
@ 2017-06-27 14:23 ` Jeff Layton
  0 siblings, 0 replies; 2+ messages in thread
From: Jeff Layton @ 2017-06-27 14:23 UTC (permalink / raw)
  To: Yan, Zheng, ceph-devel

On Tue, 2017-06-27 at 21:43 +0800, Yan, Zheng wrote:
> Signed-off-by: "Yan, Zheng" <zyan@redhat.com>
> ---
>  fs/ceph/caps.c | 11 +++++++++--
>  1 file changed, 9 insertions(+), 2 deletions(-)
> 
> diff --git a/fs/ceph/caps.c b/fs/ceph/caps.c
> index f555245..7007ae2 100644
> --- a/fs/ceph/caps.c
> +++ b/fs/ceph/caps.c
> @@ -3809,6 +3809,7 @@ void ceph_handle_caps(struct ceph_mds_session *session,
>   */
>  void ceph_check_delayed_caps(struct ceph_mds_client *mdsc)
>  {
> +	struct inode *inode;
>  	struct ceph_inode_info *ci;
>  	int flags = CHECK_CAPS_NODELAY;
>  
> @@ -3824,9 +3825,15 @@ void ceph_check_delayed_caps(struct ceph_mds_client *mdsc)
>  		    time_before(jiffies, ci->i_hold_caps_max))
>  			break;
>  		list_del_init(&ci->i_cap_delay_list);
> +
> +		inode = igrab(&ci->vfs_inode);
>  		spin_unlock(&mdsc->cap_delay_lock);
> -		dout("check_delayed_caps on %p\n", &ci->vfs_inode);
> -		ceph_check_caps(ci, flags, NULL);
> +
> +		if (inode) {
> +			dout("check_delayed_caps on %p\n", inode);
> +			ceph_check_caps(ci, flags, NULL);
> +			iput(inode);
> +		}
>  	}
>  	spin_unlock(&mdsc->cap_delay_lock);
>  }

Reviewed-by: Jeff Layton <jlayton@redhat.com>

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2017-06-27 14:24 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-06-27 13:43 [PATCH] ceph: avoid accessing freeing inode in ceph_check_delayed_caps() Yan, Zheng
2017-06-27 14:23 ` Jeff Layton

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.