Project

General

Profile

Actions

Bug #15702

closed

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

Added by Zhi Zhang almost 8 years ago. Updated over 7 years ago.

Status:
Resolved
Priority:
Normal
Assignee:
-
Category:
-
Target version:
-
% 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:
Crash signature (v1):
Crash signature (v2):

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 2 (0 open2 closed)

Copied to CephFS - Backport #16082: hammer: mds: wrongly treat symlink inode as normal file/dir when symlink inode is stale on kcephfsResolvedNathan CutlerActions
Copied to CephFS - Backport #16083: jewel: mds: wrongly treat symlink inode as normal file/dir when symlink inode is stale on kcephfsResolvedNathan CutlerActions
Actions #2

Updated by Zhi Zhang almost 8 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.

Actions #3

Updated by Nathan Cutler almost 8 years ago

  • Project changed from Ceph to CephFS
  • Category deleted (1)
  • Status changed from New to Fix Under Review
Actions #4

Updated by Greg Farnum almost 8 years ago

  • Status changed from Fix Under Review to Pending Backport
  • Backport changed from hammer to hammer, jewel
Actions #5

Updated by Loïc Dachary almost 8 years ago

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

Updated by Loïc Dachary almost 8 years ago

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

Updated by Loïc Dachary over 7 years ago

  • Status changed from Pending Backport to Resolved
Actions

Also available in: Atom PDF