summaryrefslogtreecommitdiffstats
path: root/fs/nfs.c
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2020-06-11 07:57:14 +0200
committerSascha Hauer <s.hauer@pengutronix.de>2020-07-05 16:17:12 +0200
commitd0d073f12aaf09e856dc779cdf36410e3c8c68ea (patch)
tree762a131236160f88ff573da91f4058cbe75b112f /fs/nfs.c
parentb31478f0ba4dcb4f9cc3e1c3c404c106702b4ccf (diff)
downloadbarebox-d0d073f12aaf09e856dc779cdf36410e3c8c68ea.tar.gz
barebox-d0d073f12aaf09e856dc779cdf36410e3c8c68ea.tar.xz
fs: Add destroy_inode callbacks to filesystems
Several filesystems rely on the default function which frees the struct inode * rather than the filesystem specific inode which the inode is embedded in. This works because the inode is the first element in the filesystem specific inode. Let's not depend on this behaviour and for clarity add the destroy_inode callbacks to all filesystems. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'fs/nfs.c')
-rw-r--r--fs/nfs.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/fs/nfs.c b/fs/nfs.c
index 15ddab7915..6c4637281d 100644
--- a/fs/nfs.c
+++ b/fs/nfs.c
@@ -1202,6 +1202,13 @@ static struct inode *nfs_alloc_inode(struct super_block *sb)
return &node->inode;
}
+static void nfs_destroy_inode(struct inode *inode)
+{
+ struct nfs_inode *node = nfsi(inode);
+
+ free(node);
+}
+
static const struct inode_operations nfs_file_inode_operations;
static const struct file_operations nfs_dir_operations;
static const struct inode_operations nfs_dir_inode_operations;
@@ -1273,6 +1280,7 @@ static const struct inode_operations nfs_dir_inode_operations =
static const struct super_operations nfs_ops = {
.alloc_inode = nfs_alloc_inode,
+ .destroy_inode = nfs_destroy_inode,
};
static char *rootnfsopts;