From: Erez_Zadok Date: Fri, 16 Nov 2007 18:47:31 +0000 (-0500) Subject: Unionfs: m/c/atime invariant checking debugging code X-Git-Url: https://git.fsl.cs.sunysb.edu/?a=commitdiff_plain;h=9cc115c6a985b2bd2fc952efae622e5d33e81e86;p=unionfs-odf.git Unionfs: m/c/atime invariant checking debugging code Add checks to verify that lower inode times are not newer than our own inode times. Introduce two useful utility debugging functions to print inode times. Signed-off-by: Erez Zadok --- diff --git a/fs/unionfs/debug.c b/fs/unionfs/debug.c index 34ef190e7f..b4d35d62e7 100644 --- a/fs/unionfs/debug.c +++ b/fs/unionfs/debug.c @@ -299,6 +299,26 @@ void __unionfs_check_dentry(const struct dentry *dentry, bindex, dstart, dend); } } + /* check if lower inode is newer than upper one (it shouldn't) */ + if (is_newer_lower(dentry)) { + PRINT_CALLER(); + for (bindex=ibstart(inode); bindex <= ibend(inode); bindex++) { + lower_inode = unionfs_lower_inode_idx(inode, bindex); + if (!lower_inode) + continue; + printk(" CI8: bindex=%d mtime/lmtime=%lu.%lu/%lu.%lu " + "ctime/lctime=%lu.%lu/%lu.%lu\n", + bindex, + inode->i_mtime.tv_sec, + inode->i_mtime.tv_nsec, + lower_inode->i_mtime.tv_sec, + lower_inode->i_mtime.tv_nsec, + inode->i_ctime.tv_sec, + inode->i_ctime.tv_nsec, + lower_inode->i_ctime.tv_sec, + lower_inode->i_ctime.tv_nsec); + } + } } void __unionfs_check_file(const struct file *file, @@ -401,3 +421,50 @@ void __show_branch_counts(const struct super_block *sb, } printk("%s:%s:%d\n",file,fxn,line); } + +void __show_inode_times(const struct inode *inode, + const char *file, const char *fxn, int line) +{ + struct inode *lower_inode; + int bindex; + + for (bindex=ibstart(inode); bindex <= ibend(inode); bindex++) { + lower_inode = unionfs_lower_inode_idx(inode, bindex); + if (!lower_inode) + continue; + printk("IT(%lu:%d): ", inode->i_ino, bindex); + printk("%s:%s:%d ",file,fxn,line); + printk("um=%lu/%lu lm=%lu/%lu ", + inode->i_mtime.tv_sec, inode->i_mtime.tv_nsec, + lower_inode->i_mtime.tv_sec, + lower_inode->i_mtime.tv_nsec); + printk("uc=%lu/%lu lc=%lu/%lu\n", + inode->i_ctime.tv_sec, inode->i_ctime.tv_nsec, + lower_inode->i_ctime.tv_sec, + lower_inode->i_ctime.tv_nsec); + } +} + +void __show_dinode_times(const struct dentry *dentry, + const char *file, const char *fxn, int line) +{ + struct inode *inode = dentry->d_inode; + struct inode *lower_inode; + int bindex; + + for (bindex=ibstart(inode); bindex <= ibend(inode); bindex++) { + lower_inode = unionfs_lower_inode_idx(inode, bindex); + if (!lower_inode) + continue; + printk("DT(%s:%lu:%d): ", dentry->d_name.name, inode->i_ino, bindex); + printk("%s:%s:%d ",file,fxn,line); + printk("um=%lu/%lu lm=%lu/%lu ", + inode->i_mtime.tv_sec, inode->i_mtime.tv_nsec, + lower_inode->i_mtime.tv_sec, + lower_inode->i_mtime.tv_nsec); + printk("uc=%lu/%lu lc=%lu/%lu\n", + inode->i_ctime.tv_sec, inode->i_ctime.tv_nsec, + lower_inode->i_ctime.tv_sec, + lower_inode->i_ctime.tv_nsec); + } +} diff --git a/fs/unionfs/union.h b/fs/unionfs/union.h index 33119d6e6c..aeabc433be 100644 --- a/fs/unionfs/union.h +++ b/fs/unionfs/union.h @@ -562,6 +562,11 @@ static inline struct dentry *__odf_dstack_pop(struct dentry_stack *stack) __FILE__,__FUNCTION__,__LINE__) #define show_branch_counts(sb) __show_branch_counts((sb), \ __FILE__,__FUNCTION__,__LINE__) +#define show_inode_times(i) __show_inode_times((i), \ + __FILE__,__FUNCTION__,__LINE__) +#define show_dinode_times(d) __show_dinode_times((d), \ + __FILE__,__FUNCTION__,__LINE__) + extern void __unionfs_check_inode(const struct inode *inode, const char *fname, const char *fxn, int line); extern void __unionfs_check_dentry(const struct dentry *dentry, @@ -571,6 +576,10 @@ extern void __unionfs_check_file(const struct file *file, const char *fname, const char *fxn, int line); extern void __show_branch_counts(const struct super_block *sb, const char *file, const char *fxn, int line); +extern void __show_inode_times(const struct inode *inode, + const char *file, const char *fxn, int line); +extern void __show_dinode_times(const struct dentry *dentry, + const char *file, const char *fxn, int line); #else /* not UNIONFS_DEBUG */ @@ -579,6 +588,8 @@ extern void __show_branch_counts(const struct super_block *sb, #define unionfs_check_dentry(d) #define unionfs_check_file(f) #define show_branch_counts(sb) +#define show_inode_times(i) +#define show_dinode_times(d) #endif /* not UNIONFS_DEBUG */