Skip to content

cephfs: fix write_buf's _len overflow problem - #13587

Merged
jcsp merged 1 commit into
ceph:masterfrom
yanghonggang:master
Apr 15, 2017
Merged

jcsp merged 1 commit into
ceph:masterfrom
yanghonggang:master

Conversation

@yanghonggang

Copy link
Copy Markdown
Contributor

After I have set about 400 64KB xattr kv pair to a file,
mds is crashed. Every time I try to start mds, it will crash again.
The root reason is write_buf._len overflowed when doing
Journaler::append_entry().

This patch try to fix this problem through the following changes:

1. limit file/dir's xattr size
2. throttle journal entry append operations
3. add bufferlist _len overflow checking

Fixes: http://tracker.ceph.com/issues/19033
Signed-off-by: Yang Honggang [email protected]

@yanghonggang

Copy link
Copy Markdown
Contributor Author

@jcsp Your comments and suggestions will be greatly appreciated.

@ukernel

ukernel commented Feb 23, 2017

Copy link
Copy Markdown
Contributor

please split the change into three commit. one for buffer.{h,cc}, one for Journaler.{h,cc} and one for Server.cc

@yanghonggang

Copy link
Copy Markdown
Contributor Author

@ukernel done!

@jcsp
jcsp requested a review from ukernel March 8, 2017 11:20
@jcsp

jcsp commented Mar 8, 2017

Copy link
Copy Markdown
Contributor

@ukernel does this look good to you?

@liewegas liewegas added bug-fix cephfs Ceph File System labels Mar 8, 2017
@yanghonggang

Copy link
Copy Markdown
Contributor Author

@ukernel @jcsp please help to review. many thanks.

@yanghonggang

Copy link
Copy Markdown
Contributor Author

@liewegas @ukernel @jcsp @gregsfortytwo

Normal user of our fs can damage the whole system by writing huge xattr kv pairs. I think this is a serious bug. Your quick reply can help me to fix this bug as soon as possible. Thank you for your time to review this patch.

Comment thread src/common/buffer.cc Outdated

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd prefer if these asserts are compiled conditionally, for full debug builds only. This is already performance sensitive path that affects everyone.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@branch-predictor

Yes, this will affect performance. I think assert can be disabled globally by specifing DCMAKE_CXX_FLAGS="-DNDEBUG ..." cmake variable. Any better suggestion?

@jcsp

jcsp commented Apr 12, 2017

Copy link
Copy Markdown
Contributor

The Server and Journaler commits look good. After chatting with @liewegas the consensus on the buffer.h asserts is that although we already have lots of asserts there, we probably don't want to add more.

If you could drop the buffer.h commit from this PR, it will be good to merge.

@yanghonggang

Copy link
Copy Markdown
Contributor Author

@jcsp @branch-predictor @ukernel
Thank you for your suggestions, buffer.h commit is dropped. And commits are squashed together.

Comment thread src/mds/Server.cc Outdated

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i'd recommend use the range-based loop when possible.

Comment thread src/mds/Server.cc Outdated

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please wrap at 80 chars.

After I have set about 400 64KB xattr kv pair to a file,
mds is crashed. Every time I try to start mds, it will crash again.
The root reason is write_buf._len overflowed when doing
Journaler::append_entry().

This patch try to fix this problem through the following changes:

 1. limit file/dir's xattr size
 2. throttle journal entry append operations

Fixes: http://tracker.ceph.com/issues/19033
Signed-off-by: Yang Honggang [email protected]
@yanghonggang

Copy link
Copy Markdown
Contributor Author

@tchaikov
all lines are wrapped at 80 characters and change for to range-based.

@jcsp
jcsp merged commit c65e4fb into ceph:master Apr 15, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug-fix cephfs Ceph File System

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants