Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 20 Jun 2013 19:56:26 +0000 (UTC)
From:      John Baldwin <jhb@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org
Subject:   svn commit: r252041 - stable/9/sys/ofed/include/linux
Message-ID:  <201306201956.r5KJuQcI054354@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: jhb
Date: Thu Jun 20 19:56:26 2013
New Revision: 252041
URL: http://svnweb.freebsd.org/changeset/base/252041

Log:
  MFC 251617:
  Store a reference to the vnode associated with a file descriptor in the
  linux_file structure and use it instead of directly accessing td_fpop
  when destroying the linux_file structure.  The td_fpop pointer is not
  valid when a cdevpriv destructor is run, and the type-specific close
  method has already been called, so f_vnode may not be valid (and the
  vnode might have been recycled without our own reference).

Modified:
  stable/9/sys/ofed/include/linux/fs.h
  stable/9/sys/ofed/include/linux/linux_compat.c
Directory Properties:
  stable/9/sys/   (props changed)

Modified: stable/9/sys/ofed/include/linux/fs.h
==============================================================================
--- stable/9/sys/ofed/include/linux/fs.h	Thu Jun 20 19:08:12 2013	(r252040)
+++ stable/9/sys/ofed/include/linux/fs.h	Thu Jun 20 19:56:26 2013	(r252041)
@@ -73,6 +73,7 @@ struct linux_file {
 	struct dentry	f_dentry_store;
 	struct selinfo	f_selinfo;
 	struct sigio	*f_sigio;
+	struct vnode	*f_vnode;
 };
 
 #define	file		linux_file

Modified: stable/9/sys/ofed/include/linux/linux_compat.c
==============================================================================
--- stable/9/sys/ofed/include/linux/linux_compat.c	Thu Jun 20 19:08:12 2013	(r252040)
+++ stable/9/sys/ofed/include/linux/linux_compat.c	Thu Jun 20 19:56:26 2013	(r252041)
@@ -211,7 +211,8 @@ linux_file_dtor(void *cdp)
 	struct linux_file *filp;
 
 	filp = cdp;
-	filp->f_op->release(curthread->td_fpop->f_vnode, filp);
+	filp->f_op->release(filp->f_vnode, filp);
+	vdrop(filp->f_vnode);
 	kfree(filp);
 }
 
@@ -231,6 +232,8 @@ linux_dev_open(struct cdev *dev, int ofl
 	filp->f_dentry = &filp->f_dentry_store;
 	filp->f_op = ldev->ops;
 	filp->f_flags = file->f_flag;
+	vhold(file->f_vnode);
+	filp->f_vnode = file->f_vnode;
 	if (filp->f_op->open) {
 		error = -filp->f_op->open(file->f_vnode, filp);
 		if (error) {



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201306201956.r5KJuQcI054354>