From 08bb83d95027bb3ac68834d12b72bdc647fa24a9 Mon Sep 17 00:00:00 2001 From: Marc Dionne Date: Tue, 25 Jan 2011 17:17:21 -0500 Subject: [PATCH] linux: 2.6.38: New d_op handling In 2.6.38, the super block structure has a new field to hold the default dentry ops. The vfs will automatically set it for new dentries in most cases. Set s_d_op to our set of operations, and omit setting the dentry ops where the vfs will already do it (and where new locking rules prohibit it). Change-Id: I9d738bdd528577d0a7ccd307246b5e935379c84d Reviewed-on: http://gerrit.openafs.org/3758 Tested-by: BuildBot Reviewed-by: Derrick Brashear --- acinclude.m4 | 1 + src/afs/LINUX/osi_vfsops.c | 7 +++++++ src/afs/LINUX/osi_vnodeops.c | 6 ++++++ 3 files changed, 14 insertions(+) diff --git a/acinclude.m4 b/acinclude.m4 index 94376aa9f..6ae09af6a 100644 --- a/acinclude.m4 +++ b/acinclude.m4 @@ -776,6 +776,7 @@ case $AFS_SYSNAME in *_linux* | *_umlinux*) AC_CHECK_LINUX_STRUCT([nameidata], [path], [namei.h]) AC_CHECK_LINUX_STRUCT([proc_dir_entry], [owner], [proc_fs.h]) AC_CHECK_LINUX_STRUCT([super_block], [s_bdi], [fs.h]) + AC_CHECK_LINUX_STRUCT([super_block], [s_d_op], [fs.h]) AC_CHECK_LINUX_STRUCT([super_operations], [alloc_inode], [fs.h]) AC_CHECK_LINUX_STRUCT([super_operations], [evict_inode], diff --git a/src/afs/LINUX/osi_vfsops.c b/src/afs/LINUX/osi_vfsops.c index 22146d750..921efac78 100644 --- a/src/afs/LINUX/osi_vfsops.c +++ b/src/afs/LINUX/osi_vfsops.c @@ -108,6 +108,11 @@ afs_fill_super(struct super_block *sb, void *data, int silent) sb->s_blocksize_bits = 10; sb->s_magic = AFS_VFSMAGIC; sb->s_op = &afs_sops; /* Super block (vfs) ops */ + +#if defined(STRUCT_SUPER_BLOCK_HAS_S_D_OP) + sb->s_d_op = &afs_dentry_operations; +#endif + /* used for inodes backing_dev_info field, also */ afs_backing_dev_info = osi_Alloc(sizeof(struct backing_dev_info)); #if defined(HAVE_LINUX_BDI_INIT) @@ -182,7 +187,9 @@ afs_root(struct super_block *afsp) /* setup super_block and mount point inode. */ afs_globalVp = tvp; afsp->s_root = d_alloc_root(ip); +#if !defined(STRUCT_SUPER_BLOCK_HAS_S_D_OP) afsp->s_root->d_op = &afs_dentry_operations; +#endif } else code = ENOENT; } diff --git a/src/afs/LINUX/osi_vnodeops.c b/src/afs/LINUX/osi_vnodeops.c index dd330e24e..40a06a2ed 100644 --- a/src/afs/LINUX/osi_vnodeops.c +++ b/src/afs/LINUX/osi_vnodeops.c @@ -1029,7 +1029,9 @@ afs_linux_create(struct inode *dip, struct dentry *dp, int mode) afs_getattr(vcp, &vattr, credp); afs_fill_inode(ip, &vattr); insert_inode_hash(ip); +#if !defined(STRUCT_SUPER_BLOCK_HAS_S_D_OP) dp->d_op = &afs_dentry_operations; +#endif dp->d_time = hgetlo(VTOAFS(dip)->f.m.DataVersion); d_instantiate(dp, ip); } @@ -1067,7 +1069,9 @@ afs_linux_lookup(struct inode *dip, struct dentry *dp) if (hlist_unhashed(&ip->i_hash)) insert_inode_hash(ip); } +#if !defined(STRUCT_SUPER_BLOCK_HAS_S_D_OP) dp->d_op = &afs_dentry_operations; +#endif dp->d_time = hgetlo(VTOAFS(dip)->f.m.DataVersion); AFS_GUNLOCK(); @@ -1251,7 +1255,9 @@ afs_linux_mkdir(struct inode *dip, struct dentry *dp, int mode) afs_getattr(tvcp, &vattr, credp); afs_fill_inode(ip, &vattr); +#if !defined(STRUCT_SUPER_BLOCK_HAS_S_D_OP) dp->d_op = &afs_dentry_operations; +#endif dp->d_time = hgetlo(VTOAFS(dip)->f.m.DataVersion); d_instantiate(dp, ip); } -- 2.39.5