[Cbe-oss-dev] [PATCH] spufs: spu_create should send inotify IM_CREATE event

Christoph Hellwig hch at lst.de
Wed Mar 19 18:05:27 EST 2008


On Mon, Mar 17, 2008 at 04:54:12AM +0100, Arnd Bergmann wrote:
> On Friday 14 March 2008, Christoph Hellwig wrote:
> > Creating a spufs context or gand using spu_create should send an inotify
> > event so that things like performance monitors have an easy way to find
> > out about newly created contexts.
> > 
> > 
> > Signed-off-by: Christoph Hellwig <hch at lst.de>
> 
> Looks good, but what happens about destruction of a gang or context?
> Do we already get a nameremove or inoderemove notification for that,
> or would we need another change for that?

Ok, destruction is a more complicated as the notification is handled
by d_delete which spufs should but doesn't call currently.  The fix
seems easy and the patch below gives me the inotify delete notifcation
and passes Jeremy's testsuite without regression.


Signed-off-by: Christoph Hellwig <hch at lst.de>

Index: linux-2.6/arch/powerpc/platforms/cell/spufs/inode.c
===================================================================
--- linux-2.6.orig/arch/powerpc/platforms/cell/spufs/inode.c	2008-03-19 07:34:43.000000000 +0100
+++ linux-2.6/arch/powerpc/platforms/cell/spufs/inode.c	2008-03-19 07:49:41.000000000 +0100
@@ -172,7 +172,6 @@ static int spufs_rmdir(struct inode *par
 {
 	/* remove all entries */
 	spufs_prune_dir(dir);
-	d_drop(dir);
 
 	return simple_rmdir(parent, dir);
 }
@@ -227,6 +226,9 @@ static int spufs_dir_close(struct inode 
 	mutex_lock(&parent->i_mutex);
 	ret = spufs_rmdir(parent, dir);
 	mutex_unlock(&parent->i_mutex);
+
+	if (!ret)
+		d_delete(dir);
 	WARN_ON(ret);
 
 	/* We have to give up the mm_struct */
@@ -478,8 +480,13 @@ spufs_create_context(struct inode *inode
 	 */
 	ret = spufs_context_open(dget(dentry), mntget(mnt));
 	if (ret < 0) {
-		WARN_ON(spufs_rmdir(inode, dentry));
+		int ret;
+
+		ret = spufs_rmdir(inode, dentry);
 		mutex_unlock(&inode->i_mutex);
+		if (!ret)
+			d_delete(dentry);
+		WARN_ON(ret);
 		spu_forget(SPUFS_I(dentry->d_inode)->i_ctx);
 		goto out;
 	}



More information about the cbe-oss-dev mailing list