--- linux-2.6.33/fs/dcache.c.org 2011-04-04 08:20:20.382107296 +0200 +++ linux-2.6.33/fs/dcache.c 2011-04-04 09:05:40.182805269 +0200 @@ -2123,7 +2123,6 @@ */ void dentry_update_name_case(struct dentry *dentry, struct qstr *name) { - BUG_ON(!mutex_is_locked(&dentry->d_inode->i_mutex)); BUG_ON(dentry->d_name.len != name->len); /* d_lookup gives this */ spin_lock(&dentry->d_lock); --- linux-2.6.33/fs/ncpfs/dir.c.org 2011-04-04 08:16:21.812659616 +0200 +++ linux-2.6.33/fs/ncpfs/dir.c 2011-04-04 09:52:18.822549265 +0200 @@ -583,6 +583,7 @@ struct qstr qname; int valid = 0; int hashed = 0; + int wasLocked = 1; ino_t ino = 0; __u8 __name[NCP_MAXPATHLEN + 1]; @@ -620,7 +621,23 @@ * server. Parent dir's i_mutex is locked because we're in * readdir. */ + + struct inode *inode = dentry->d_inode; + + if(inode) { + if(!mutex_is_locked(&dentry->d_inode->i_mutex)) { + mutex_lock(&inode->i_mutex); + wasLocked = 0; + } + } + dentry_update_name_case(newdent, &qname); + + if(inode) { + if(!wasLocked) { + mutex_unlock(&inode->i_mutex); + } + } } if (!newdent->d_inode) {