ONTAP Discussions

NetApp C-Mode (8.2) :- Unable to open offline file having file path greater than 1040 chars

CHIRANJIVCCHOUDHARY
4,405 Views

Hi All,

I am not able to open file after setting offline attribute for file path greater than 1040 characters. If the file path is less than 1040 characters then everything is working fine.

After setting offline attribute ( SetFileAttributes(csFilename, (fileAttributes | FILE_ATTRIBUTE_OFFLINE));) on file (path>1040) opening that file using CreateFile(csFilename, GENERIC_READ|GENERIC_WRITE, 0, NULL, TRUNCATE_EXISTING, FILE_ATTRIBUTE_NORMAL|FILE_FLAG_BACKUP_SEMANTICS, NULL); fails with error 1359 (internal error).

Has anyone face this issue before? Is there any limitation from NetApp C-Mode side on maximum characters on file path?

Following is piece of code

CString csFilename(L"\\\\?\\UNC\\adnetcm1.punecft.evault.symantec.com\\AD_Share\\Test\\NetCVol\\1stop\\long\\abcd\\abcd\\abcd\\abcd\\abcd\\abcd\\abcd\\abcd\\abcd\\abcd\\abcd\\abcd\\abcd\\abcd\\abcd\\abcd\\abcd\\abcd\\abcd\\abcd\\abcd\\abcd\\abcd\\abcd\\abcd\\abcd\\abcd\\abcd\\abcd\\abcd\\abcd\\abcd\\abcd\\abcd\\abcd\\abcd\\abcd\\1stop\\pqrs\\pqrs\\pqrs\\pqrs\\pqrs\\pqrs\\pqrs\\pqrs\\pqrs\\pqrs\\pqrs\\pqrs\\pqrs\\pqrs\\pqrs\\pqrs\\pqrs\\pqrs\\pqrs\\pqrs\\pqrs\\pqrs\\pqrs\\pqrs\\pqrs\\pqrs\\pqrs\\pqrs\\pqrs\\pqrs\\pqrs\\pqrs\\pqrs\\pqrs\\pqrs\\pqrs\\pqrs\\pqrs\\pqrs\\pqrs\\pqrs\\pqrs\\pqrs\\pqrs\\pqrs\\pqrs\\pqrs\\pqrs\\pqrs\\pqrs\\1stop\\pqrs\\pqrs\\pqrs\\pqrs\\pqrs\\pqrs\\pqrs\\pqrs\\pqrs\\pqrs\\pqrs\\pqrs\\pqrs\\pqrs\\pqrs\\pqrs\\pqrs\\pqrs\\pqrs\\pqrs\\pqrs\\pqrs\\pqrs\\pqrs\\pqrs\\pqrs\\pqrs\\pqrs\\pqrs\\pqrs\\pqrs\\pqrs\\pqrs\\pqrs\\pqrs\\pqrs\\pqrs\\pqrs\\pqrs\\pqrs\\pqrs\\pqrs\\pqrs\\pqrs\\pqrs\\pqrs\\pqrs\\pqrs\\1stop\\pqrs\\pqrs\\pqrs\\pqrs\\pqrs\\pqrs\\pqrs\\pqrs\\pqrs\\pqrs\\pqrs\\pqrs\\pqrs\\pqrs\\pqrs\\pqrs\\pqrs\\pqrs\\pqrs\\pqrs\\pqrs\\pqrs\\pqrs\\pqrs\\pqrs\\pqrs\\pqrs\\pqrs\\pqrs\\pqrs\\pqrs\\pqrs\\pqrs\\pqrs\\pqrs\\pqrs\\pqrs\\pqrs\\pqrs\\pqrs\\pqrs\\pqrs\\pqrs\\pqrs\\pqrs\\pqrs\\pqrs\\pqrs\\1stop\\pqrs\\pqrs\\pqrs\\pqrs\\pqrs\\pqrs\\pqrs\\pqrs\\pqrs\\pqrs\\pqrs\\pqrs\\pqrs\\pqrs\\pqrs\\pqrs\\pqrs\\pqrs\\pqrs\\pqrs\\pqrs\\pqrs\\pqrs\\pqrs\\pqrs\\pqrs\\pqrs\\pqrs\\pqrs\\pqrs\\pqrs\\pqrs\\pqrs\\pqrs\\pqrs\\pqrs\\pqrs\\pqrs\\pqrs\\pqrs\\pqrs\\pqrs\\pqrs\\pqrs\\pqrs\\pqrs\\pqrs\\pqrs\\long\\abcd\\abcd\\abcd\\abcd\\abcd\\abcd\\abcd\\abcd\\abcd\\abcd\\abcd\\abcd\\abcd\\abcd\\abcd\\abcd\\abcd\\abcd\\abcd\\abcd\\24.txt");

HANDLE hFile = ::CreateFile(csFilename, GENERIC_READ|GENERIC_WRITE, 0, NULL, TRUNCATE_EXISTING, FILE_ATTRIBUTE_NORMAL|FILE_FLAG_BACKUP_SEMANTICS, NULL);

if (hFile == INVALID_HANDLE_VALUE)

{

printf("Unable to open file handle on file %s, error: %ld", csFilename, GetLastError());

CloseHandle(hFile);

exit(0);

}

CloseHandle(hFile);

WIN32_FILE_ATTRIBUTE_DATA data;

DWORD fileAttributes = GetFileAttributes(csFilename);

if(INVALID_FILE_ATTRIBUTES == fileAttributes)

printf("GetFileAttributes Failed %d", GetLastError());

SetFileAttributes(csFilename, (fileAttributes | FILE_ATTRIBUTE_OFFLINE));

hFile = ::CreateFile(csFilename, GENERIC_READ|GENERIC_WRITE, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL|FILE_FLAG_BACKUP_SEMANTICS, NULL);

if (hFile == INVALID_HANDLE_VALUE)

{

printf("Unable to open file handle on file %s, error: %ld", csFilename, GetLastError());

CloseHandle(hFile);

exit(0);

}

CloseHandle(hFile);

2 REPLIES 2

sandeepj
4,405 Views

Is this issue only with offline files? We do have limits on path length (1024 bytes) and this should hold for any file path. Windows also have path limit (http://msdn.microsoft.com/en-us/library/windows/desktop/aa365247(v=vs.85).aspx#maxpath) of 260 unless some special syntax is used. I see you are using path with prefix ("\\?\UNC\") which allows the client to send long paths (upto 32767 cahracters) and ontap does not support such long paths. I believe this is the same behavior in 7-mode as well. Is this change of behavior from 7-mode?

CHIRANJIVCCHOUDHARY
4,405 Views

Looking into it. I will let you know ASAP.Thanks

Public