@@ -246,8 +246,8 @@ static void debugfs_release_dentry(struct dentry *dentry)
246
246
if ((unsigned long )fsd & DEBUGFS_FSDATA_IS_REAL_FOPS_BIT )
247
247
return ;
248
248
249
- /* check it wasn't a dir (no fsdata) or automount (no real_fops ) */
250
- if (fsd && ( fsd -> real_fops || fsd -> short_fops ) ) {
249
+ /* check it wasn't a dir or automount (no fsdata ) */
250
+ if (fsd ) {
251
251
WARN_ON (!list_empty (& fsd -> cancellations ));
252
252
mutex_destroy (& fsd -> cancellations_mtx );
253
253
}
@@ -257,9 +257,9 @@ static void debugfs_release_dentry(struct dentry *dentry)
257
257
258
258
static struct vfsmount * debugfs_automount (struct path * path )
259
259
{
260
- struct debugfs_fsdata * fsd = path -> dentry -> d_fsdata ;
260
+ struct inode * inode = path -> dentry -> d_inode ;
261
261
262
- return fsd -> automount (path -> dentry , d_inode ( path -> dentry ) -> i_private );
262
+ return DEBUGFS_I ( inode ) -> automount (path -> dentry , inode -> i_private );
263
263
}
264
264
265
265
static const struct dentry_operations debugfs_dops = {
@@ -642,38 +642,27 @@ struct dentry *debugfs_create_automount(const char *name,
642
642
void * data )
643
643
{
644
644
struct dentry * dentry = start_creating (name , parent );
645
- struct debugfs_fsdata * fsd ;
646
645
struct inode * inode ;
647
646
648
647
if (IS_ERR (dentry ))
649
648
return dentry ;
650
649
651
- fsd = kzalloc (sizeof (* fsd ), GFP_KERNEL );
652
- if (!fsd ) {
653
- failed_creating (dentry );
654
- return ERR_PTR (- ENOMEM );
655
- }
656
-
657
- fsd -> automount = f ;
658
-
659
650
if (!(debugfs_allow & DEBUGFS_ALLOW_API )) {
660
651
failed_creating (dentry );
661
- kfree (fsd );
662
652
return ERR_PTR (- EPERM );
663
653
}
664
654
665
655
inode = debugfs_get_inode (dentry -> d_sb );
666
656
if (unlikely (!inode )) {
667
657
pr_err ("out of free dentries, can not create automount '%s'\n" ,
668
658
name );
669
- kfree (fsd );
670
659
return failed_creating (dentry );
671
660
}
672
661
673
662
make_empty_dir_inode (inode );
674
663
inode -> i_flags |= S_AUTOMOUNT ;
675
664
inode -> i_private = data ;
676
- dentry -> d_fsdata = fsd ;
665
+ DEBUGFS_I ( inode ) -> automount = f ;
677
666
/* directory inodes start off with i_nlink == 2 (for "." entry) */
678
667
inc_nlink (inode );
679
668
d_instantiate (dentry , inode );
0 commit comments