Skip to content

Commit

Permalink
VFS: Fix up debugfs to use d_is_dir() in place of S_ISDIR()
Browse files Browse the repository at this point in the history
Fix up debugfs to use d_is_dir(dentry) in place of
S_ISDIR(dentry->d_inode->i_mode).

Signed-off-by: David Howells <[email protected]>
Signed-off-by: Al Viro <[email protected]>
  • Loading branch information
dhowells authored and ananjaser1211 committed Oct 15, 2023
1 parent 98791cf commit b83468f
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion fs/debugfs/inode.c
Original file line number Diff line number Diff line change
Expand Up @@ -486,7 +486,7 @@ static int __debugfs_remove(struct dentry *dentry, struct dentry *parent)

if (debugfs_positive(dentry)) {
dget(dentry);
if (S_ISDIR(dentry->d_inode->i_mode))
if (d_is_dir(dentry))
ret = simple_rmdir(parent->d_inode, dentry);
else
simple_unlink(parent->d_inode, dentry);
Expand Down
4 changes: 2 additions & 2 deletions fs/ecryptfs/file.c
Original file line number Diff line number Diff line change
Expand Up @@ -484,7 +484,7 @@ static int ecryptfs_open(struct inode *inode, struct file *file)
#ifdef CONFIG_SDP
if (crypt_stat->flags & ECRYPTFS_DEK_IS_SENSITIVE) {
#ifdef CONFIG_SDP_KEY_DUMP
if (d_is_reg(ecryptfs_dentry)) {
if (S_ISREG(ecryptfs_dentry->d_inode->i_mode)) {
if(get_sdp_sysfs_key_dump()) {
printk("FEK[%s] : ", ecryptfs_dentry->d_name.name);
key_dump(crypt_stat->key, 32);
Expand All @@ -494,7 +494,7 @@ static int ecryptfs_open(struct inode *inode, struct file *file)
/*
* Need to update sensitive mapping on file open
*/
if (d_is_reg(ecryptfs_dentry)) {
if (S_ISREG(ecryptfs_dentry->d_inode->i_mode)) {
ecryptfs_set_mapping_sensitive(inode, mount_crypt_stat->userid, TO_SENSITIVE);
}

Expand Down
2 changes: 1 addition & 1 deletion fs/ecryptfs/inode.c
Original file line number Diff line number Diff line change
Expand Up @@ -1351,7 +1351,7 @@ static int ecryptfs_setattr(struct dentry *dentry, struct iattr *ia)
mutex_lock(&crypt_stat->cs_mutex);
if (d_is_dir(dentry))
crypt_stat->flags &= ~(ECRYPTFS_ENCRYPTED);
else if (d_is_reg(dentry)
else if (S_ISREG(dentry->d_inode->i_mode)
&& (!(crypt_stat->flags & ECRYPTFS_POLICY_APPLIED)
|| !(crypt_stat->flags & ECRYPTFS_KEY_VALID))) {
struct ecryptfs_mount_crypt_stat *mount_crypt_stat;
Expand Down

0 comments on commit b83468f

Please sign in to comment.