Modifying Samba to skip file system reads for IOZONE READ and
REREAD
Iozone
capps at iozone.org
Sat Oct 29 00:51:10 GMT 2005
----- Original Message -----
From: "Richard Sharpe" <rsharpe at richardsharpe.com>
To: "Iozone" <capps at iozone.org>
Cc: "Jeremy Allison" <jra at samba.org>; <samba-technical at lists.samba.org>
Sent: Friday, October 28, 2005 6:57 PM
Subject: Re: Modifying Samba to skip file system reads for IOZONE READ and
REREAD
> On Fri, 28 Oct 2005, Iozone wrote:
>
>>>> The new version of Iozone will become available within the
>>>> next 24 hours on the Iozone web site. This version will
>>>> disable your, un-ethical, hack. Please take a few moments
>>>> of introspection and ponder of the value of honesty to
>>>> the public. There is no real value in providing mechanisms
>>>> that tell lies to the consumer.
>>>
>>> Can you explain more about this post ? I don't think I've understood
>>> what has been going on here ?
>>>
>>> Thanks,
>>>
>>> Jeremy Allison,
>>> Samba Team.
>>>
>>
>> Jeremy,
>>
>> Iozone measures a filesystem's performance by writing and
>> reading files. Mr. Sharpe, provided a hack in Samba that
>> detects when Iozone is running. (keying off of the file names
>> that Iozone uses) This hack intercepts the user's reading
>> of a file, detects that it is Iozone running, and then
>> allocates buffers and fills them in with what it knows
>> Iozone wants. Thus, the user's reads NEVER made it
>> to the filesystem at all, and the results reported by
>> Iozone will not reflect the filesystem, but a deliberate
>> HACK, specifically targeted towards circumventing
>> accurate measurement by Iozone. Thus, telling the user
>> lies. These lies will NOT reflect any other application
>> running and will only mislead the consumer into believing
>> that the system is fast, when in reality it may suck big-time !
>>
>> Richard's code is NOT cool. It is a deliberate attempt
>> to tell the users of Samba LIES. IT IS NOT COOL !
>>
>> I have immediately modified Iozone so that Richard's
>> hack will not work, and in fact, will now only serve to
>> demonstrate that Samba is broken, and returning the
>> WRONG data from a file that was just written.
>> Iozone will change the contents of its data files with every
>> new version. Any attempt to try this sort of *&&%&% again
>> will result in Iozone telling the user that Samba is broken
>> and should not be used for storing data.
>>
>> Richard: Your hack is NOT in the interest of honesty
>> or beneficial to the public. It is just plain evil.
>
> Don,
>
> I have always found your help in the past to be very useful, but I fear
> you have over-reacted to something that was intended to help people debug
> performance issues.
>
> I have already responded to an earlier message, and did so before seeing
> this response. However, I feel that I must respond.
>
> Did you think about what you were typing before making claims that I am an
> unethical person?
>
> Perhaps if you had sent me a short email asking me what my intent was
> before making outrageous public claims we could have dealt with the issue
> in a more reasonable manner.
>
> For the record, I agree that people should not be able to defeat
> benchmarking programs like IOZONE and so forth.
>
> Regards
> -------
> Richard Sharpe, rsharpe[at]richardsharpe.com, rsharpe[at]samba.org,
> sharpe[at]ethereal.com, http://www.richardsharpe.com
>
Richard,
Your post did not include anything about this being a lab
experiment, but did offer to provide the hack to disable Iozone
accuracy.
Perhaps I am a bit overly sensitive, but the post could easily be
interpreted, by anyone in the world, as a valid mechanism to
blind side Iozone and have their Samba produce outrageous
results. There are no comments in the post about the intent
of the code.
My reading of the post was that this code is available from
you for anyone that desired to have it. Thus, my reaction
to this technique.
I've lived in the benchmarking world for many years,
seen every dirty trick, and watched the consumers get
bit by such optimizations. When I see something like
this, it really gets under my skin.
I agree that Iozone should take more care to avoid such
activities, and a new version will be available within
24 hours to address this issue.
Your post:
--------------------
Hi,
In exploring some performance issues I had with highly variable read
performance (difference of 25MB/s between highest and lowest numbers), I
modified Samba to skip file system reads for IOZONE files ...
Attached are the diffs ... in case anyone else wants to do something
similar.
Regards
-----
Richard Sharpe, rsharpe[at]richardsharpe.com, rsharpe[at]samba.org,
sharpe[at]ethereal.com, http://www.richardsharpe.com
-------------- next part --------------
==== //depot/branch/pioneer-mg/src/samba/source/include/smb.h#1 -
/usr1/rsharpe/rsharpe-calpc02-pioneer-mg/src/samba/source/include/smb.h ====
@@ -415,6 +415,8 @@
BOOL directory_delete_on_close;
char *fsp_name;
FAKE_FILE_HANDLE *fake_file_handle;
+ BOOL iozone_file;
+ char *buffer;
#ifdef PANFS_LOCKS
SMB_BIG_UINT share_lock_handle; /* Keeps a share lock */
#endif
==== //depot/branch/pioneer-mg/src/samba/source/smbd/close.c#3 -
/usr1/rsharpe/rsharpe-calpc02-pioneer-mg/src/samba/source/smbd/close.c ====
@@ -324,6 +324,8 @@
if (fsp->fsp_name)
string_free(&fsp->fsp_name);
+ if (fsp->iozone_file) SAFE_FREE(fsp->buffer);
+
file_free(fsp);
if (err == -1 || err1 == -1) {
==== //depot/branch/pioneer-mg/src/samba/source/smbd/open.c#4 -
/usr1/rsharpe/rsharpe-calpc02-pioneer-mg/src/samba/source/smbd/open.c ====
@@ -327,6 +327,37 @@
return False;
}
+ /*
+ * Little hack for IOZONE ... if name is iozone.DUMMY.
+ * then set a flag and create a buffer for read
+ */
+ {
+ const char * slashloc = strrchr(fname, '/');
+ if (!slashloc) slashloc = fname;
+ if (strncmp(fname, "iozone.DUMMY.", 13) == 0) {
+ DEBUG(0, ("IOZONE file detected: %s. Using IOZONE
trick.\n",fname));
+ fsp->iozone_file = True;
+ fsp->buffer = (char *)malloc(65536);
+ if (!fsp->buffer) {
+ DEBUG(0, ("Unable to allocate memory for IOZONE
trick. Falling back.\n"));
+ fsp->iozone_file = False;
+ }
+ else {
+ int i, j;
+ memset(fsp->buffer, '\0', 65536);
+ /* set the funny pattern in the buffer */
+ for (i = 0; i < 65536; i += 32) {
+ fsp->buffer[i] = 0xA5;
+ }
+ for (i = 0; i < 65536; i = i + 4096) {
+ for (j = 0; j < 8; j++) {
+ fsp->buffer[i + j] = 0xA5;
+ }
+ }
+ }
+ }
+ }
+
/* Inherit the ACL if the file was created. */
if ((local_flags & O_CREAT) && !VALID_STAT(*psbuf))
inherit_access_acl(conn, fname, mode);
==== //depot/branch/pioneer-mg/src/samba/source/smbd/reply.c#3 -
/usr1/rsharpe/rsharpe-calpc02-pioneer-mg/src/samba/source/smbd/reply.c ====
@@ -2175,6 +2175,11 @@
#endif
+ if (fsp->iozone_file) {
+ memcpy(data, fsp->buffer, smb_maxcnt);
+ nread = smb_maxcnt;
+ }
+ else
nread = read_file(fsp,data,startpos,smb_maxcnt);
if (nread < 0) {
----------------
More information about the samba-technical
mailing list