Deadly change to dentry_operations ?

Richard Gooch (rgooch@atnf.CSIRO.AU)
Thu, 15 Jan 1998 10:40:29 +1100


Hi, Linus. I've just noticed that struct dentry_operations has had a
new field added: "d_iput". However that field wasn't added after the
existing ones. I was lucky to notice this because I got a warning
message thus:
warning: initialization from incompatible pointer type

because I set the "d_release" field in my devfs code. This change has
the potential to be deadly, since "d_release" functions will be called
when a "d_iput" should be done.

Shouldn't the new "d_iput" field be placed last? A quick scan of
2.1.79 shows that no-one else seems to use "d_release", but I still
don't think it's a good idea. I've appended a patch to fix this.

Regards,

Richard....

--- dcache.h.old Tue Jan 13 22:35:20 1998
+++ dcache.h Thu Jan 15 10:38:03 1998
@@ -74,8 +74,8 @@
int (*d_hash) (struct dentry *, struct qstr *);
int (*d_compare) (struct dentry *, struct qstr *, struct qstr *);
void (*d_delete)(struct dentry *);
- void (*d_iput)(struct dentry *, struct inode *);
void (*d_release)(struct dentry *);
+ void (*d_iput)(struct dentry *, struct inode *);
};

/* the dentry parameter passed to d_hash and d_compare is the parent