Project

General

Profile

Bug #15702

mds: wrongly treat symlink inode as normal file/dir when symlink inode is stale on kcephfs

Added by Zhi Zhang almost 3 years ago. Updated over 2 years ago.

Status:
Resolved
Priority:
Normal
Assignee:
-
Category:
-
Target version:
-
Start date:
05/03/2016
Due date:
% Done:

0%

Source:
Community (dev)
Tags:
Backport:
hammer, jewel
Regression:
No
Severity:
3 - minor
Reviewed:
Affected Versions:
ceph-qa-suite:
Component(FS):
Labels (FS):
Pull request ID:

Description

This issue should happen on kcephfs only. My kernel version is 3.10.94. I think it might also happen on other 3.x versions.

Steps to reproduce on kcephfs:
1. Create a symlink to a directory, both are on kcephfs.
2. Use opendir/readdir function to open/read this symlink. It will succeed at this time.
3. Wait for some time or just umount cephfs and remount it for quick validation.
4. Just Use opendir/readdir function to open/read this symlink again without any other ops before opendir. Now it will fail.

The root cause is that after some time, this symlink's inode lease will be invalid (function: ceph_d_revalidate). When accessing this inode next time, kcephfs uses atomic_open on it and send related req to MDS. MDS treats this inode as a file but its flag is O_DIRECTORY, so MDS return EINVAL to client. Similar reason when using umounting/remounting for valication.

The fix could be checking if this indoe is symlink on MDS side for atomic_open. If it is, MSD could return this inode's info to client, then client could fill this inode with correct info and set inode's iop to symlink iops. Then kernel will retry on this symlink.


Related issues

Copied to fs - Backport #16082: hammer: mds: wrongly treat symlink inode as normal file/dir when symlink inode is stale on kcephfs Resolved
Copied to fs - Backport #16083: jewel: mds: wrongly treat symlink inode as normal file/dir when symlink inode is stale on kcephfs Resolved

History

#2 Updated by Zhi Zhang almost 3 years ago

I have tried to backport Yan's following patch, which can only resolve this issue when symlink dentry is invalid, but can't fully resolve it if umounting/remounting cephfs again.

https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/fs/ceph?id=200fd27c8fa2ba8bb4529033967b69a7cbfa2c2e

So I made above change on MDS side, which can resolve both cases.

#3 Updated by Nathan Cutler almost 3 years ago

  • Project changed from Ceph to fs
  • Category deleted (1)
  • Status changed from New to Need Review

#4 Updated by Greg Farnum almost 3 years ago

  • Status changed from Need Review to Pending Backport
  • Backport changed from hammer to hammer, jewel

#5 Updated by Loic Dachary almost 3 years ago

  • Copied to Backport #16082: hammer: mds: wrongly treat symlink inode as normal file/dir when symlink inode is stale on kcephfs added

#6 Updated by Loic Dachary almost 3 years ago

  • Copied to Backport #16083: jewel: mds: wrongly treat symlink inode as normal file/dir when symlink inode is stale on kcephfs added

#7 Updated by Loic Dachary over 2 years ago

  • Status changed from Pending Backport to Resolved

Also available in: Atom PDF