Skip to contentSkip to conversation

rpdfs: Add basic tmpfile support

PATCH Applied Chris Kirby 2 participants 2 messages Oct 26 – Oct 27

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 rpdfs: Add basic tmpfile support

This is sufficient for getting basic xfstests passing.

---
Changes in v2:
- Remove unnecessary comment about tmpfile orphans
- Mark the inode dirty before unlocking

 fs/rpdfs/dir.c | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)
fs/rpdfs/dir.c +20 -0
index 42af325012ab..e3d6dc9e12ec 100644
@@ -754,6 +754,25 @@ static int rpdfs_readdir(struct file *file, struct dir_context *ctx)
 	return ret;
 }
 
+/*
+ * Basic tmpfile support. This still needs to mark the inode as an orphan.
+ */
+static int rpdfs_tmpfile(struct mnt_idmap *idmap, struct inode *dir,
+			 struct file *file, umode_t mode)
+{
+	struct inode *inode;
+
+	inode = create_new_inode(idmap, dir, NULL, mode);
+	if (IS_ERR(inode))
+		return PTR_ERR(inode);
+
+	d_tmpfile(file, inode);
+	mark_inode_dirty(inode);
+	unlock_new_inode(inode);
+
+	return finish_open_simple(file, 0);
+}
+
 const struct inode_operations rpdfs_dir_iops = {
 	.create		= rpdfs_create,
 	.getattr	= rpdfs_getattr,
@@ -762,6 +781,7 @@ const struct inode_operations rpdfs_dir_iops = {
 	.mkdir		= rpdfs_mkdir,
 	.rename		= rpdfs_rename,
 	.setattr	= rpdfs_setattr,
+	.tmpfile	= rpdfs_tmpfile,
 	.unlink		= rpdfs_unlink,
 	.rmdir		= rpdfs_rmdir,
 };
Signature · 1 line
2.55.0
Applied
#1 lore raw
Quoted 1 line · Chris Kirby

This is sufficient for getting basic xfstests passing.

Applied, thanks!

- z